Question: 2. Mixed Bag: This question concerns several different data structures topics in one question. (a) Consider an array-based implementation strategy for a queue, where queued

 2. Mixed Bag: This question concerns several different data structures topics

2. Mixed Bag: This question concerns several different data structures topics in one question. (a) Consider an array-based implementation strategy for a queue, where queued integers [e.g. 7, 2, 3, 5, 9 as below] are held in a fixed-size array of 6 elements, supported by two integer variables F and R representing the position of the front (0) and rear (4) of the queue in the array. Explain how simple enqueue and dequeue operations could be implemented for a linear fixed-size array such as this. You may use pseudo-code if you feel it is helpful, and you can include diagrams to help illustrate your answer. (b) There is a problem with a simple linear array-backed implementation as shown above that renders it effectively impractical. (Hint: the problem isn't the small size - it's acceptable it can only hold 6 elements at any one time) i) Identify and describe the problem with this implementation. ii) Identify and describe an approach to resolve this problem whilst retaining an underlying fixed-size array. You can use diagrams as necessary to help illustrate your points (c) The acronyms FIFO and LIFO are used to describe list-like data structures. Expand these acronyms and explain which is relevant for a queue. (d) You are tasked with deciding between two possible List implementation strategies for some software you're writing. The first is Vector , a dynamic array. The second is LinkedList , a doubly-linked list. Indicate your preferred choice, in the following scenario, along with clear justifications: You are writing a logging service for a small memory-constrained system that produces a log entry every 20m. Each log entry is appended to the log, including a short description, a longer message and a timestamp. At the end of the day, logs are output in reverse order, and the system must allow the user to view the longer message by selecting the log entry from a list. The log is then extracted from the device and cleared. Which of the two suggested data structures would be most appropriate and why? 2. Mixed Bag: This question concerns several different data structures topics in one question. (a) Consider an array-based implementation strategy for a queue, where queued integers [e.g. 7, 2, 3, 5, 9 as below] are held in a fixed-size array of 6 elements, supported by two integer variables F and R representing the position of the front (0) and rear (4) of the queue in the array. Explain how simple enqueue and dequeue operations could be implemented for a linear fixed-size array such as this. You may use pseudo-code if you feel it is helpful, and you can include diagrams to help illustrate your answer. (b) There is a problem with a simple linear array-backed implementation as shown above that renders it effectively impractical. (Hint: the problem isn't the small size - it's acceptable it can only hold 6 elements at any one time) i) Identify and describe the problem with this implementation. ii) Identify and describe an approach to resolve this problem whilst retaining an underlying fixed-size array. You can use diagrams as necessary to help illustrate your points (c) The acronyms FIFO and LIFO are used to describe list-like data structures. Expand these acronyms and explain which is relevant for a queue. (d) You are tasked with deciding between two possible List implementation strategies for some software you're writing. The first is Vector , a dynamic array. The second is LinkedList , a doubly-linked list. Indicate your preferred choice, in the following scenario, along with clear justifications: You are writing a logging service for a small memory-constrained system that produces a log entry every 20m. Each log entry is appended to the log, including a short description, a longer message and a timestamp. At the end of the day, logs are output in reverse order, and the system must allow the user to view the longer message by selecting the log entry from a list. The log is then extracted from the device and cleared. Which of the two suggested data structures would be most appropriate and why

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!