Data Structure is an important topic for Computer Science students preparing for Bihar STET. It deals with techniques for organizing, storing and processing data efficiently.
These notes cover important concepts such as arrays, linked lists, stacks, queues, trees, graphs, searching, sorting, recursion and algorithm complexity, followed by important MCQs for practice.
What is a Data Structure?
A data structure is a method of organizing and storing data so that it can be accessed and modified efficiently.
Examples:
Array
Linked List
Stack
Queue
Tree
Graph
Hash Table
Types of Data Structures
Data structures can broadly be classified into two categories.
1. Linear Data Structure
Elements are arranged sequentially.
Examples:
Array
Linked List
Stack
Queue
2. Non-Linear Data Structure
Elements are organized hierarchically or as a network.
Examples:
Tree
Graph
Array
An array is a collection of elements of the same data type stored in contiguous memory locations.
Advantages
Fast random access
Simple implementation
Efficient for indexed access
Disadvantages
Fixed size in traditional static arrays
Insertion and deletion can be expensive
Requires contiguous memory
Array Access
Accessing an element by index generally takes O(1) time.
Linked List
A linked list consists of nodes where each node contains data and a link/reference to another node.
Types of Linked Lists
Singly Linked List
Doubly Linked List
Circular Linked List
Singly Linked List
Each node contains:
Data
Pointer/reference to the next node
Doubly Linked List
Each node generally contains:
Previous pointer
Data
Next pointer
Advantages of Linked List
Dynamic size
Efficient insertion/deletion when the position/node reference is available
Does not require contiguous memory
Disadvantages
Extra memory for pointers/references
No direct random access
Sequential traversal is required
Stack
A stack is a linear data structure that follows the LIFO (Last In, First Out) principle.
The main operations are:
Push
Pop
Peek/Top
Applications of Stack
Function calls
Recursion
Expression evaluation
Parentheses matching
Undo operations
Backtracking
Queue
A queue follows the FIFO (First In, First Out) principle.
Main Operations
Enqueue – Insert an element
Dequeue – Remove an element
Front/Peek – Access the front element
Applications
CPU scheduling
Printer queues
Breadth-First Search
Network buffering
Types of Queue
Circular Queue
The last position is logically connected to the first position.
Priority Queue
Elements are processed according to priority rather than simply arrival order.
Deque
A double-ended queue allows insertion and deletion at both ends.
Tree
A tree is a non-linear hierarchical data structure.
Important terms:
Root
Parent
Child
Sibling
Leaf
Edge
Height
Depth
Subtree
Binary Tree
A binary tree is a tree in which each node has at most two children.
The two children are generally called:
Left child
Right child
Binary Search Tree (BST)
In a standard BST:
Values in the left subtree are smaller than the node's key.
Values in the right subtree are larger than the node's key.
Tree Traversal
Three important depth-first traversal methods are:
Preorder
Inorder
Postorder
Preorder: Root → Left → Right
Inorder: Left → Root → Right
Postorder: Left → Right → Root
For a standard Binary Search Tree, inorder traversal produces elements in sorted order.
Heap
A heap is a complete binary tree that satisfies the heap property.
Max Heap
The parent node is greater than or equal to its children.
Min Heap
The parent node is less than or equal to its children.
Heaps are commonly used to implement priority queues.
Graph
A graph consists of vertices (nodes) and edges connecting them.
Graphs may be:
Directed
Undirected
Weighted
Unweighted
Connected
Disconnected
Graph Representation
Common representations are:
Adjacency Matrix
Adjacency List
Graph Traversal
Two important graph traversal techniques are:
BFS – Breadth-First Search
DFS – Depth-First Search
BFS
BFS generally uses a queue.
DFS
DFS can be implemented using a stack or recursion.
Searching Algorithms
Searching means finding a particular element in a data structure.
Linear Search
Linear search checks elements one by one.
Time Complexity:
Best case: O(1)
Worst case: O(n)
Binary Search
Binary search repeatedly divides the search space into two halves.
It requires the data to be sorted.
Time Complexity:
Best case: O(1)
Worst case: O(log n)
Sorting Algorithms
Sorting arranges data in a particular order, such as ascending or descending.
Important sorting algorithms include:
Bubble Sort
Selection Sort
Insertion Sort
Merge Sort
Quick Sort
Heap Sort
Bubble Sort
Repeatedly compares adjacent elements and swaps them when they are in the wrong order.
Typical worst-case time complexity:
O(n²)
Selection Sort
Repeatedly selects the minimum or maximum element and places it in the appropriate position.
Typical time complexity:
O(n²)
Insertion Sort
Builds the sorted sequence one element at a time.
Worst-case time complexity:
O(n²)
Merge Sort
Uses the divide-and-conquer technique.
Time complexity:
O(n log n)
Quick Sort
Uses a pivot to partition the array.
Average-case time complexity:
O(n log n)
Worst-case time complexity:
O(n²)
Heap Sort
Uses a heap data structure.
Time complexity:
O(n log n)
Recursion
Recursion is a technique in which a function calls itself to solve a smaller instance of the same problem.
A recursive solution normally requires:
Base case
Recursive case
Recursion uses the call stack to maintain function calls.
Examples:
Factorial
Fibonacci
Tree traversal
DFS
Divide-and-conquer algorithms
Algorithm Complexity
Algorithm efficiency is commonly analyzed using time complexity and space complexity.
Common Big-O Complexities
| Complexity | Example |
|---|---|
| O(1) | Array access by index |
| O(log n) | Binary search |
| O(n) | Linear search |
| O(n log n) | Merge sort |
| O(n²) | Bubble sort |
Big-O notation describes an asymptotic upper bound on growth of resource usage, commonly time or space.
Hashing
Hashing maps a key to a location using a hash function.
A hash table can provide very efficient average-case search, insertion and deletion.
Collision
A collision occurs when two different keys map to the same hash-table location.
Common collision-resolution techniques include:
Chaining
Open Addressing
Bihar STET Data Structure Important MCQs 2026
1. Which data structure follows LIFO?
A. Queue
B. Stack
C. Array
D. Linked List
Answer: B. Stack
2. Which data structure follows FIFO?
A. Stack
B. Queue
C. Tree
D. Heap
Answer: B. Queue
3. Which operation inserts an element into a stack?
A. Pop
B. Push
C. Enqueue
D. Delete
Answer: B. Push
4. Which operation removes an element from a stack?
A. Push
B. Insert
C. Pop
D. Enqueue
Answer: C. Pop
5. Which operation inserts an element into a queue?
A. Push
B. Pop
C. Enqueue
D. Peek
Answer: C. Enqueue
6. Which operation removes an element from a queue?
A. Push
B. Dequeue
C. Enqueue
D. Insert
Answer: B. Dequeue
7. Which data structure is best suited for implementing recursion?
A. Queue
B. Stack
C. Graph
D. Array only
Answer: B. Stack
8. Which data structure is commonly used in BFS?
A. Stack
B. Queue
C. Heap
D. Hash table
Answer: B. Queue
9. DFS can be implemented using:
A. Stack
B. Queue only
C. Hash table only
D. Array only
Answer: A. Stack
10. Binary search requires:
A. Unsorted data
B. Sorted data
C. Linked data only
D. A tree only
Answer: B. Sorted data
11. What is the worst-case time complexity of binary search?
A. O(n)
B. O(n²)
C. O(log n)
D. O(1)
Answer: C. O(log n)
12. What is the worst-case complexity of linear search?
A. O(1)
B. O(log n)
C. O(n)
D. O(n log n)
Answer: C. O(n)
13. Which traversal gives sorted order for a Binary Search Tree?
A. Preorder
B. Postorder
C. Inorder
D. Level order
Answer: C. Inorder
14. Which is the correct preorder traversal?
A. Left → Root → Right
B. Root → Left → Right
C. Left → Right → Root
D. Right → Root → Left
Answer: B. Root → Left → Right
15. Which is the correct postorder traversal?
A. Root → Left → Right
B. Left → Root → Right
C. Left → Right → Root
D. Right → Left → Root
Answer: C. Left → Right → Root
16. A binary tree node can have at most:
A. 1 child
B. 2 children
C. 3 children
D. 4 children
Answer: B. 2 children
17. Which data structure is used to implement a priority queue efficiently?
A. Heap
B. Stack
C. Linked List only
D. Array only
Answer: A. Heap
18. In a max heap, the root contains:
A. Minimum element
B. Maximum element
C. Middle element
D. Random element
Answer: B. Maximum element
19. Which sorting algorithm uses divide and conquer?
A. Bubble Sort
B. Merge Sort
C. Selection Sort
D. Linear Search
Answer: B. Merge Sort
20. The average-case time complexity of Quick Sort is:
A. O(n)
B. O(log n)
C. O(n log n)
D. O(n²)
Answer: C. O(n log n)
21. The worst-case time complexity of Quick Sort is:
A. O(1)
B. O(log n)
C. O(n log n)
D. O(n²)
Answer: D. O(n²)
22. The worst-case complexity of Bubble Sort is:
A. O(n)
B. O(log n)
C. O(n²)
D. O(n log n)
Answer: C. O(n²)
23. Which data structure uses nodes connected through links?
A. Linked List
B. Array
C. Stack only
D. Matrix
Answer: A. Linked List
24. Which linked list contains both previous and next references?
A. Singly Linked List
B. Doubly Linked List
C. Circular Queue
D. Static List
Answer: B. Doubly Linked List
25. Which data structure allows insertion and deletion at both ends?
A. Stack
B. Deque
C. Binary Tree
D. Heap
Answer: B. Deque
26. What is the time complexity of accessing an array element by index?
A. O(n)
B. O(log n)
C. O(1)
D. O(n²)
Answer: C. O(1)
27. Which notation is commonly used to represent asymptotic upper bound?
A. Big-O
B. Big-Theta only
C. Big-S
D. Big-X
Answer: A. Big-O
28. A function calling itself is known as:
A. Iteration
B. Recursion
C. Compilation
D. Traversal
Answer: B. Recursion
29. What is a collision in hashing?
A. Two keys map to the same hash location
B. A key is deleted
C. A table becomes empty
D. A search fails
Answer: A. Two keys map to the same hash location
30. Which technique is used to resolve hash collisions?
A. Chaining
B. Recursion
C. Traversal
D. Paging
Answer: A. Chaining
Quick Revision – Data Structure One-Liners
Array → Elements stored in contiguous memory in the traditional array model.
Linked List → Nodes connected through links/references.
Stack → LIFO.
Queue → FIFO.
Push → Insert into stack.
Pop → Remove from stack.
Enqueue → Insert into queue.
Dequeue → Remove from queue.
Deque → Insertion/deletion at both ends.
Tree → Hierarchical non-linear structure.
BST → Left subtree keys are smaller and right subtree keys are larger under the standard BST rule.
Inorder → Left → Root → Right.
Preorder → Root → Left → Right.
Postorder → Left → Right → Root.
Heap → Complete binary tree satisfying heap property.
BFS → Generally uses a queue.
DFS → Uses a stack or recursion.
Binary Search → Requires sorted data.
Merge Sort → O(n log n).
Quick Sort → Average O(n log n), worst O(n²).
Bubble Sort → O(n²) worst case.
Hashing → Maps keys using a hash function.
Collision → Different keys map to the same hash location.
Recursion → Function calls itself.
Big-O → Describes asymptotic upper-bound growth.
Bihar STET Data Structure Preparation Tips
For Bihar STET Computer Science, candidates should focus especially on arrays, linked lists, stacks, queues, trees, BST, heaps, graphs, searching, sorting, recursion, hashing and algorithm complexity.
Practice numerical and conceptual questions on:
Stack operations
Queue operations
Linked-list insertion/deletion
Tree traversal
BST construction
BFS and DFS
Searching complexity
Sorting algorithms
Big-O analysis
Hashing and collision resolution
Most Important Topics
Array
Linked List
Stack
Queue
Circular Queue
Priority Queue
Deque
Trees
Binary Tree
Binary Search Tree
Heap
Graph
BFS and DFS
Searching Algorithms
Sorting Algorithms
Recursion
Hashing
Time and Space Complexity
Big-O Notation