Question: 1. What restrictions on a Linked List implementation ensure that the list is performing as a Stack or Queue? Mention the restriction for both
1. What restrictions on a Linked List implementation ensure that the list is performing as a Stack or Queue? Mention the restriction for both Add and Remove operations for both a Stack and a Queue. 2. Why it is required to reserve a space when implementing a Queue using an Array data structure. Explain in your own words. 3. For each of the following algorithms or operations on data structures, mention the worst-case running time in asymptotic (big-O) notation. Justify your answer briefly. a) Searching an item in a sorted array b) Inserting an item into a sorted array c) Insert an item into a Queue d) Remove an item from a Stack
Step by Step Solution
3.43 Rating (153 Votes )
There are 3 Steps involved in it
1 Linked List as a Stack To implement a linked list as a stack you should restrict the Add operation to adding elements only at the head of the list p... View full answer
Get step-by-step solutions from verified subject matter experts
