COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Delete the first element
|
|
Insert a new element as a first element
|
|
Delete the last element of the list
|
|
Add a new element at the end of the list
|
Detailed explanation-1: -You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list? Explanation: Deletion of the first element of the list is done in O (1) time by deleting memory and changing the first pointer.
Detailed explanation-2: -Detailed Solution. We need a pointer to the element just before the node to be deleted for deletion in a singly linked list, but we have a pointer to the last node So we need to traverse from front node F to node before last node L, this operation will depend on the length of the linked list.
Detailed explanation-3: -In a singly linked circular linked list, each node has a pointer that points to the next node in the list. The last node in the list points back to the first node.
Detailed explanation-4: -The last node of the list will contain the address of first node. The starting node in linked list is pointed by a pointer called start pointer and last node is pointed by a pointer called last pointer.
Detailed explanation-5: -What does the following function do for a given Linked List with first node as head? Explanation: fun1() prints the given Linked List in reverse manner.