Question 6
What is the time complexity of accessing an element in an array by its index?
Arrays store elements in contiguous memory locations, allowing direct random access in constant time O(1) using offset arithmetic.
What is the time complexity of accessing an element in an array by its index?
Arrays store elements in contiguous memory locations, allowing direct random access in constant time O(1) using offset arithmetic.
In a singly linked list, each node contains at least -
A node in a singly linked list consists of a data field to store values and a pointer (next) referencing the address of the subsequent node.
Which linked list allows traversal in both forward and backward directions?
A Doubly Linked List contains two pointers per node-prev and next-enabling bidirectional linear traversal.
In a circular linked list, the next pointer of the last node points to the -
In a Circular Linked List, the tail node's next pointer references the head node instead of pointing to NULL, forming a circular loop.
Evaluation of a postfix expression is best implemented using which data structure?
Postfix expression evaluation uses a stack: operands are pushed onto the stack, and when an operator is encountered, two operands are popped, evaluated, and the result is pushed back.