Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use python to do. In this project, you will design your own class implementing Tower of Hanoi using stack and queue. This project will

image text in transcribed

image text in transcribed

please use python to do.

In this project, you will design your own class implementing Tower of Hanoi using stack and queue. This project will give you more experience on the use of: 1. stack and queue implementations 2. Class, class methods Project Specifications: Part-1 Implement a class, named Stack, for a standard stack using a List data structure. The stack should have the following methods: 1. i. push(item) ii. pop ii. peek) iv. isEmpty0) v. size(] 2. Create a class Queue that implements a queue data structure. It should have the following methods: enqueue(item) dequeue) ii isEmpty() iv. size() Part-2: Application Tower of Hanoi is a simple game which is usually used to demonstrate the use of recursion in algorithms. In this project, we will not use recursion. We are going to solve the game using stacks and queues. Figure-a Figure-b The objective of the game is to move the stack of disks (as shown in Figure-a) to a rod on the extreme right (as shown in Figure-b) following the below mentioned rules . Only one disk can be moved at a time . A disk cannot be placed over a smaller disk Implementation using Stack: Develop a class StackTower to implement Tower of Hanoi You will have to create three stack objects representing the rods .You need to push the three disk objects onto the rods Then you will pop from one rod and push it onto another rod .Repeat this process while making sure that you are not placing a disk over a smaller one Implementation using Queue: Now instead of using the stack class, develop a class QueueTower and use the queue class to represent the rods. Follow the steps above with modifications needed to model and solve the problem with queues Your program should print out the contents of the stack/queue at the beginning. After each move print out the contents of all the 3 stacks/queues until the final step where the third rod is populated with all the three disks. Show the simulation of solving Tower of Hanoi. Deliverables: 1. a single.py file containing the project. 2. a report - a word file which shows the outputs with appropriate screenshots. . Include a conclusion paragraph in the report. Conclusion should address the following: What you have learnt from this project? . What ways you can expand this project? .Each team member's contribution /* All students are expected to use appropriate amount of comments to explain their program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

Differentiate between theoretical and applied research.

Answered: 1 week ago

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago