Category: Recursion


Distinct ways to reach the n’th stair

Problem: Given stair case with n stairs, count the number of ways in which you can climb the stairs. Each time you can either take 1 step or 2 steps. Solution: — Number of...

Tower of hanoi 0

Tower of hanoi

Problem : The Towers of Hanoi is a classic puzzle with 3 pegs and multiple disks of different sizes. The goal of the puzzle is to move all the disks from the first peg...


Binary tree traversal

Problem description : Tree traversal (a.k.a tree search) is a form of graph traversal and refers to the process of visiting each node in a tree data structure, exactly once, in a systematic way....