- Q5 Q6 Here Is Circular Array Based Queue Algorithms Algorithm Size Return Algorithm Empty Return Algorithm Fro 1 (41.8 KiB) Viewed 77 times
Q5-Q6: Here is circular array-based queue algorithms. Algorithm size(): return Algorithm empty(): return ( Algorithm fro
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q5-Q6: Here is circular array-based queue algorithms. Algorithm size(): return Algorithm empty(): return ( Algorithm fro
Q5-Q6: Here is circular array-based queue algorithms. Algorithm size(): return Algorithm empty(): return ( Algorithm front(): if empty() then throw Queue Empty exception return Q Algorithm dequeue(): if empty() then throw Queue Empty exception f-(+1) mod N MINIL Algorithm enqueue(r): if size()-N then throw QueueFull exception grie r- (r+1) mod N n=n+1 Q7: Draw a step-by-step picture of an array when you do the following operations in succession. Assume the array size is four, and your picture should include n, f, and r from the above algorithm and the index of the array. enqueue(10), enqueue(20), enqueue(30), dequeue(), enqueue(40), enqueue(50) Q8: What is the drawback (limitation) of the above approach? To fix this issue, which data structure do you want to use and explain how it can remedy the problem.