Question 1
What is the time complexity to insert an element at the beginning of a Singly Linked List?
Inserting at the head requires creating a node, updating its next pointer to head, and moving head to the new node, taking constant O(1) time.
What is the time complexity to insert an element at the beginning of a Singly Linked List?
Inserting at the head requires creating a node, updating its next pointer to head, and moving head to the new node, taking constant O(1) time.
Which one of the following is the size of int arr[9] assuming that int is of 4 bytes?
The size of integer is 4 bytes. The array stores 9 elements, so the total size allocated in memory is 9*4=36 bytes.
Which condition indicates that a Circular Singly Linked List with head pointer 'head' is empty?
An empty circular linked list has no nodes, so its head pointer is NULL. (If it contains 1 node, head->next == head).
In a dynamic array that doubles its capacity when full, what is the amortized time complexity of an append operation?
An individual append that triggers reallocation can take O(N) time, but with geometric capacity doubling, a sequence of N appends performs O(N) total work. Therefore, the amortized time per append is O(1).
In a max-heap containing N elements, what is the time complexity to find the minimum element?
In a max-heap, the minimum element must reside in one of the leaf nodes. Since there are ceil(N/2) leaf nodes, searching among them requires linear time O(N).