Question: In the implementation of Singly linked list we had an integer variable called size that keeps track of how many elements in the list.
In the implementation of Singly linked list we had an integer variable called size that keeps track of how many elements in the list. Also, we have a reference "tail" that points to the last node in the list. You are asked to re-implement the concept of singly linked list without using variable size, and without using reference "tail". a) What are the methods of the main operation of singly linked list that need to be changed? Rewrite them according to this change (only the methods that need to be changed). b) Will that affect the performance of any one of the main operations( size, isEmpty, first, last, addFirst, addLast, removeFirst, removeLast)? Explain. Q2) Using a single queue (linkedQueue), re-implement the concept of Stack ADT, what is the complexity of the method push, pop, top, isEmpty, and size. You should not use any extra data structure.
Step by Step Solution
There are 3 Steps involved in it
a To reimplement a singly linked list without using a variable for size and without a reference to the tail youll need to make changes to the followin... View full answer
Get step-by-step solutions from verified subject matter experts
