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
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
Physics,
2 months ago
Hindi,
2 months ago
India Languages,
4 months ago
Chemistry,
10 months ago
Math,
10 months ago