Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

77 e arch-for Integer 'target , in A found binarySearch (data.currentItem ), target) 5 data.goForth O Using the active operation approach to timing analysis determine

image text in transcribed

77 e arch-for Integer 'target , in A found binarySearch (data.currentItem ), target) 5 data.goForth O Using the active operation approach to timing analysis determine the time complexity of this pseu- docode in the worst case. Assume that the list of arrays contains n arrays and that each array has exactly m items in it. Show all your work and express your final answer in Big-O notation. Question 8 (17 points) A priority queue is a queue where a numeric priority is associated with each element. Access to elements that have been inserted into the queue is limited to inspection and removal of the elements with smallest and largest priority only. A priority queue may have multiple items that are of equal Give the ADT specification for a bounded priority queue using the specification method described in Topic 7 of the lecture notes. By "bounded", it is meant that the priority queue has a maximum capacity specified when it is created, and it can never contain more than that number of items. Your specification must specify the following operations: Page 3 newPriorityQueue: make a new queue insert: inserts an element with a certain priority isEmpty: test if the queue is empty isFull: test if the queue is full maxltem: obtain the item in the queue with the highest priority minltem: obtain the item in the queue with the lowest priority delete deleteAlIMax: remove from the queue all items that are tied for the highest priority delete Min: remove from the queue the item with the lowest priority frequency: obtain the number of times a certain item occurs in the queue (with any priority) Max: remove from the queue the item with the highest priority 8 6 9 77 e arch-for Integer 'target , in A found binarySearch (data.currentItem ), target) 5 data.goForth O Using the active operation approach to timing analysis determine the time complexity of this pseu- docode in the worst case. Assume that the list of arrays contains n arrays and that each array has exactly m items in it. Show all your work and express your final answer in Big-O notation. Question 8 (17 points) A priority queue is a queue where a numeric priority is associated with each element. Access to elements that have been inserted into the queue is limited to inspection and removal of the elements with smallest and largest priority only. A priority queue may have multiple items that are of equal Give the ADT specification for a bounded priority queue using the specification method described in Topic 7 of the lecture notes. By "bounded", it is meant that the priority queue has a maximum capacity specified when it is created, and it can never contain more than that number of items. Your specification must specify the following operations: Page 3 newPriorityQueue: make a new queue insert: inserts an element with a certain priority isEmpty: test if the queue is empty isFull: test if the queue is full maxltem: obtain the item in the queue with the highest priority minltem: obtain the item in the queue with the lowest priority delete deleteAlIMax: remove from the queue all items that are tied for the highest priority delete Min: remove from the queue the item with the lowest priority frequency: obtain the number of times a certain item occurs in the queue (with any priority) Max: remove from the queue the item with the highest priority 8 6 9

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 Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions

Question

9. Describe the characteristics of power.

Answered: 1 week ago