Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

tower of hanoi

/// find total number of steps 
int towerOfHanoi(int n) {
  /// pow(2,n)-1
  if (n == 0) return 0;
  
  return towerOfHanoi(n - 1) + 1 + towerOfHanoi(n - 1);
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #tower #hanoi
ADD COMMENT
Topic
Name
1+5 =