An alternative implementation of singly linked list is to create a structure of two external
pointers for the list, which contains both head and tail pointers.(( )* )
1
i ThoughtNumber MaximumNumber ThoughtNumber ThoughtNumber
n
i
100 *100
struct list {
nodeptr head;
nodeptr tail;
};
These pointers points to the first and the last elements of the list. Thus, the cost of
inserting a new element at end and deleting from the end of the list will be optimized to
O(1). Therefore, considering the given specification, write a C++ program which
implements the necessary operations for both unsorted and sorted list.
I. For unsorted list
Insertion of new element at head and at end
Deletion of an element from head, end and any element which mentioned with
key
Search
II. For sorted list
Insertion of new element at its proper position
Deletion of an element from head, end and any element which mentioned with
key
Search
Comments
Leave a comment