Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this lab is to practice writing Linked List implementations and implementing the Queue ADT with a different underlying data structure. Complete the

The purpose of this lab is to practice writing Linked List implementations and implementing the Queue ADT with a different underlying data structure.

Complete the implementations of the Queue_Fast_Front and Queue_Fast_Back ADTs to have O(1) dequeue and enqueue respectively. Compare the times.(for this question, your answer maybe not exactly the same as the output file.)

Implement a variation of Hot Potato, where at the end of each passing cycle, the direction of play is reversed. In addition to the queue from the original game, you will need to use a stack.

Add a count(item) function to the SimpleLinkedList ADT which returns the number of times the given item is found in the linked list.

code with python3

input example:dog cat fish cat horse snake cat dog tarrasque cat dog snake tarrasque output1:

What should the size of the queue be? 1000 For Queue_Fast_Front with 1000 elements, the estimated running time for enqueue was 2 s. For Queue_Fast_Back with 1000 elements, the estimated running time for enqueue was 1 s. For Queue_Fast_Front with 1000 elements, the estimated running time for dequeue was 1 s. For Queue_Fast_Back with 1000 elements, the estimated running time for dequeue was 2 s.

What should the size of the queue be? 10000 For Queue_Fast_Front with 10000 elements, the estimated running time for enqueue was 10 s. For Queue_Fast_Back with 10000 elements, the estimated running time for enqueue was 1 s. For Queue_Fast_Front with 10000 elements, the estimated running time for dequeue was 1 s. For Queue_Fast_Back with 10000 elements, the estimated running time for dequeue was 15 s.

What should the size of the queue be? 20000 For Queue_Fast_Front with 20000 elements, the estimated running time for enqueue was 21 s. For Queue_Fast_Back with 20000 elements, the estimated running time for enqueue was 1 s. For Queue_Fast_Front with 20000 elements, the estimated running time for dequeue was 4 s. For Queue_Fast_Back with 20000 elements, the estimated running time for dequeue was 30 s.

output 2 example:

How many times should the potato be passed every round? 0 Winner: Sue

How many times should the potato be passed every round? 1 Winner: Bob

How many times should the potato be passed every round? 3 Winner: Bob

How many times should the potato be passed every round? 18 Winner: Sue

output 3 example:

Occurrences of cat: 3 Occurrences of dog: 2 Occurrences of snake: 1 Occurrences of tarrasque: 1

it`s also have 3 example .py files but i cant upate them.

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions