Basic Data Structures Flashcards
7 cards from real AMCAT practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Basic Data Structures flashcards as text
Which operation on a singly linked list has O(n) time complexity in the worst case?
Answer: Accessing an element by index
Accessing by index requires traversing from the head, taking O(n) time in the worst case.
What is the maximum number of elements that can be stored in a 2D array declared as int a[4][5]?
Answer: 20
A 2D array of dimensions 4×5 holds 4*5 = 20 elements.
In a doubly linked list, each node contains:
Answer: Data and two pointers (next and previous)
Each node in a doubly linked list stores data plus pointers to both the next and previous nodes.
Which data structure uses a LIFO (Last In, First Out) access pattern?
Answer: Stack
A stack follows LIFO — the last element pushed is the first one popped.
What is the time complexity for inserting an element at the beginning of a dynamic array (ArrayList)?
Answer: O(n)
Inserting at the beginning requires shifting all existing elements one position to the right, which is O(n).
Which of the following is NOT a linear data structure?
Answer: Binary Tree
A binary tree is a hierarchical (non-linear) structure, unlike arrays, linked lists, and queues.
In a circular linked list, the last node's next pointer points to:
Answer: The head node
In a circular linked list, the last node's next pointer wraps back to the head, forming a circle.