4 Lecture
CS301
Midterm & Final Term Short Notes
Methods of Linked List
Linked List is a data structure that stores a sequence of elements in memory. There are several methods to manipulate Linked List, including insertion, deletion, traversal, and searching. These methods involve pointers that point to the next or
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is the time complexity of inserting an element at the beginning of a singly linked list? a) O(n) b) O(log n) c) O(1) d) O(n^2) Answer: c) O(1)
Which of the following is not a type of Linked List? a) Singly Linked List b) Doubly Linked List c) Circular Linked List d) Binary Linked List Answer: d) Binary Linked List
What is the time complexity of inserting an element at the end of a singly linked list? a) O(n) b) O(log n) c) O(1) d) O(n^2) Answer: a) O(n)
Which of the following is not a pointer used in Linked List? a) head pointer b) tail pointer c) node pointer d) root pointer Answer: d) root pointer
What is the time complexity of deleting an element from a singly linked list? a) O(n) b) O(log n) c) O(1) d) O(n^2) Answer: a) O(n)
Which of the following Linked List traversal technique involves recursion? a) Linear traversal b) Binary traversal c) Depth First Traversal d) Breadth First Traversal Answer: c) Depth First Traversal
Which of the following is a disadvantage of using a doubly linked list? a) Faster traversal in both directions b) Requires more memory than singly linked list c) More difficult to implement than singly linked list d) Allows insertion and deletion of elements only at the beginning of the list Answer: b) Requires more memory than singly linked list
Which of the following is not a type of node used in Linked List? a) data node b) header node c) sentinel node d) tail node Answer: a) data node
Which of the following Linked List method is used to reverse the order of elements in the list? a) reverse() b) rotate() c) shuffle() d) sort() Answer: a) reverse()
Which of the following is a type of circular linked list? a) Circular doubly linked list b) Circular binary linked list c) Circular balanced linked list d) Circular heap linked list Answer: a) Circular doubly linked list
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is a Linked List? Answer: A Linked List is a linear data structure that consists of a sequence of nodes, where each node contains data and a pointer to the next (and possibly the previous) node in the list.
What is the difference between a singly linked list and a doubly linked list? Answer: In a singly linked list, each node has a pointer to the next node in the list, while in a doubly linked list, each node has a pointer to both the next and previous nodes in the list.
What is a head pointer and a tail pointer in a Linked List? Answer: The head pointer points to the first node in the list, while the tail pointer points to the last node in the list.
How is a new node inserted at the beginning of a singly linked list? Answer: To insert a new node at the beginning of a singly linked list, a new node is created and its next pointer is set to the current head of the list. The head pointer is then updated to point to the new node.
How is a new node inserted at the end of a singly linked list? Answer: To insert a new node at the end of a singly linked list, a new node is created and its next pointer is set to NULL. The next pointer of the current last node is updated to point to the new node, and the tail pointer is updated to point to the new node.
How is a node deleted from a singly linked list? Answer: To delete a node from a singly linked list, the next pointer of the previous node is updated to point to the next node in the list. The memory occupied by the deleted node is then freed.
What is a sentinel node in a Linked List? Answer: A sentinel node is a dummy node that is added to the beginning or end of a Linked List to simplify certain operations, such as inserting or deleting nodes at the beginning or end of the list.
What is the time complexity of searching for an element in a Linked List? Answer: The time complexity of searching for an element in a Linked List is O(n), where n is the number of nodes in the list.
How is a Linked List traversed recursively? Answer: A Linked List can be traversed recursively by starting at the head of the list and calling a function that takes the current node as an argument and recursively calls itself with the next node in the list.
What is a circular Linked List? Answer: A circular Linked List is a Linked List where the last node points back to the first node, creating a circular structure. This can be either a singly linked or doubly linked list.