a) 2k – 1
b) 2k + 1
c) 2k + 1
d) 2k – 1
Answer: d
Explanation: Tracing of the moves in the above ToH problem will prove this result, instead you can simply add a count for each recursive call to check the number of moves.
Related Posts
Which of the following statement is incorrect with respect to balancing symbols algorithm?
Which of the following does the balancing symbols algorithm include?
Which is the most appropriate data structure for applying balancing of symbols algorithm?
In balancing parentheses algorithm, the string is read from?
Which application of stack is used to ensure that the pair of parentheses is properly nested?
What is the time complexity of balancing parentheses algorithm?
Which data structure can be used to test a palindrome?
Join The Discussion