Computer Science, asked by pushpakl41, 4 months ago

in data structure you are given a doubly linked list that contains n nodes you want to insert a node at the beginning of this linked list
determine the worst case scenario

Answers

Answered by princeuplucky123449
0

Answer:

plz follow me.........

Explanation:

The new node is always added before the head of the given Linked List. And newly added node becomes the new head of the Linked List. For example if the given Linked List is 10->15->20->25 and we add an item 5 at the front, then the Linked List becomes 5->10->15->20->25. Let us call the function that adds at the front of the list is push(). The push() must receive a pointer to the head pointer, because push must change the head pointer to point to the new node (See this)

Similar questions