Question: Hi pls help with question 3 and 4 Exercise 3 Write an iterator for a Circular Queue, that iterates through all the items in the

Hi pls help with question 3 and 4

Hi pls help with question 3 and 4 Exercise 3 Write an

Exercise 3 Write an iterator for a Circular Queue, that iterates through all the items in the queue from front to rear Exercise 4 Consider an List class that defines a list data type with the following methods __init__(self) iter__(self) # for instance creation via List() # returning an instance of Iterator via iter() where Iterator is an iterator class of List that provides the method __next__(self) # for accessing the next item via next() (a) Define a method appears(alist, item, k) where k is an integer and appears returns True if the item appears at least k times in alist. For example, given a list with elements 8, 7, 6,7, 89, 6, 5, 3, 6, 100, where element 8 is the head, a call to appears (a list, 6, 3) would return True, while a call to appears (a list, 6, 4) would return False. IMPORTANT: the implementation should be such that you stop as soon as you know the answer is True (b) What is the best/worst Big O complexity for a list of N elements? Explain. Exercise 3 Write an iterator for a Circular Queue, that iterates through all the items in the queue from front to rear Exercise 4 Consider an List class that defines a list data type with the following methods __init__(self) iter__(self) # for instance creation via List() # returning an instance of Iterator via iter() where Iterator is an iterator class of List that provides the method __next__(self) # for accessing the next item via next() (a) Define a method appears(alist, item, k) where k is an integer and appears returns True if the item appears at least k times in alist. For example, given a list with elements 8, 7, 6,7, 89, 6, 5, 3, 6, 100, where element 8 is the head, a call to appears (a list, 6, 3) would return True, while a call to appears (a list, 6, 4) would return False. IMPORTANT: the implementation should be such that you stop as soon as you know the answer is True (b) What is the best/worst Big O complexity for a list of N elements? Explain

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!