Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
400 views
in Information Technology by (72.6k points)
closed by
A recursive problem like tower of hanoi can be rewritten without recursion using:
1. stack
2. priority queue
3. graph
4. cycles

1 Answer

0 votes
by (121k points)
selected by
 
Best answer
Correct Answer - Option 1 : stack

Concept:

  • A stack is an ordered list in which insertion and deletion are done at one end, called a top.
  • The last element inserted is the first one to be deleted. Hence, it is called the Last in First out (LIFO) or First in Last out (FILO) list.

Explanation:

A recursive problem like the Tower of Hanoi can be rewritten using system stack or user-defined stack

Recurrence relation of tower of Hanoi:  T(n) = 2T(n - 1) + 1 

Number of moves required for n disc in a Tower of Hanoi is 2– 1 = 27 – 1 = 127. 

Stack underflow happens when one tries to pop (remove) an item from the stack when nothing is actually there to remove.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...