Computer Science EngineeringHardISRO SC (CS)
Tower of Hanoi with 10 disks and three pegs needs the minimum number of moves equal to:
- A. 1024
- B. 1022
- C. 100
- D. 1023
Correct answer: D. 1023
2^n - 1 = 1023. Verified by direct computation of the recurrence for this input.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- Which data structure follows the Last-In-First-Out principle?
- The height (in edges) of a complete binary tree having n nodes is
- The time needed to build a binary heap from n arbitrary elements using bottom-up heapify is
- The maximum number of nodes in a binary tree of height h (root at height 0) is
- The recurrence T(n) = 2T(n/2) + n log n solves to
- Consider int f(int n){ if(n<=1) return 1; return f(n-1)+f(n-2); }. What does f(6) return?