Retrieving academic index assets...
Makaut
HomePYQsTests
Pricing
Sign Up
Makaut

The premier academic archive for MAKAUT students, providing curated previous year questions, solutions, and official syllabus resources.

Get the Mobile App
GET IT ONGoogle Play
Download on theApp Store
Download from Indus App Store
Platform
  • Home
  • PYQs
  • Question Papers
  • Viva Questions
  • Important Questions
  • Syllabus
  • Academic Tools
  • Pricing
  • Blog
Guidelines
  • Disclaimer
  • Community Guidelines
Company
  • About
  • Contact
  • FAQ
Legal
  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Cookie Policy
  • Subscription Policy
© 2026 MAKAUT Study Dev Hub. All rights reserved.
Platform version: v1.0.0
Viva Questions/PCC-CS301
Semester 3PCC-CS301

Data Structure & Algorithms (PCC-CS301) Viva Questions and Answers

36 Questions•8 min read
Prepared from MAKAUT past-year question papers.
Practice Mode:All answers visible
Jump to Topic
Introduction to Data Structures (2)Arrays and Linked Lists (1)Linked Lists (2)Stacks and Expression Conversion (2)Stacks (1)Queues (3)Sorting (6)Searching (2)Asymptotic Notation (1)Hashing (6)Binary Search Trees (2)Binary Trees (1)Threaded Binary Trees (1)AVL Trees (2)Graphs (3)Recursion (1)

Introduction to Data Structures

2 questions
Q1.EASY

What is a linear data structure? Give two examples.

A linear data structure stores elements in a sequential order where each element has at most one predecessor and one successor. Examples are arrays, linked lists, stacks, and queues.
Q2.EASY

Why is a binary tree not considered a linear data structure?

In a binary tree, a node can have up to two children, so elements do not form a single sequence. Traversal order is not unique and branching breaks the one-to-one adjacency of linear structures.

Arrays and Linked Lists

1 question
Q3.MEDIUM

Compare arrays and linked lists in terms of access time and memory.

Arrays allow O(1) random access but need contiguous memory and fixed size. Linked lists use non-contiguous memory and allow easy insertion/deletion, but access is O(n) because you must traverse from the head.

Linked Lists

2 questions
Q4.MEDIUM

In a doubly linked list, what pointer changes are needed to insert a new node after a given node?

Let the given node be p and the new node be q. Set q->next = p->next, q->prev = p, p->next->prev = q (if it exists), and finally p->next = q.
Q5.EASY

How would you represent the polynomial 6x6+4x3−2x+106x^6 + 4x^3 - 2x + 106x6+4x3−2x+10 using a linked list?

Use a linked list where each node stores a coefficient and an exponent, for example (6,6) -> (4,3) -> (-2,1) -> (10,0). Only non-zero terms are stored, saving space.

Stacks and Expression Conversion

2 questions
Q6.MEDIUM

Write the postfix equivalent of the prefix expression ∗+ab−cd* + ab - cd∗+ab−cd.

Convert the prefix to infix first: (a+b)∗(c−d)(a+b)*(c-d)(a+b)∗(c−d). Then the postfix form is ab+cd−∗ab+cd-*ab+cd−∗.
Q7.MEDIUM

What is the prefix expression for the infix expression a∗(b+c)/e−fa * (b + c) / e - fa∗(b+c)/e−f?

First convert to postfix: abc+∗e/f−abc+*e/f-abc+∗e/f−. Reading it backwards and flipping operands gives the prefix: −/∗a+bcef-/*a+bcef−/∗a+bcef.

Stacks

1 question
Q8.EASY

A stack undergoes: push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop. What is the final output sequence?

The popped elements in order are 2, 2, 1, 1, 2. So the output sequence is 2, 2, 1, 1, 2.

Queues

3 questions
Q9.EASY

Define a circular queue and state one advantage over a simple queue.

A circular queue is a queue where the rear wraps around to the front when it reaches the end of the array. It avoids the false overflow problem of a simple linear queue and reuses empty slots.
Q10.EASY

What is an input-restricted deque?

An input-restricted deque allows insertion only at one end but deletion from both ends. It is a double-ended queue with one end restricted for input.
Q11.MEDIUM

A queue initially has a, b, c, d with 'a' at the front. What is the minimum number of operations to get d, c, b, a?

You need 7 operations: dequeue a, b, c, d and enqueue them in order, then dequeue once more to bring d to front. Actually, using a stack-like reversal requires 7 queue operations.

Sorting

6 questions
Q12.EASY

Which sorting algorithm compares adjacent elements and swaps them if they are in the wrong order?

Bubble sort repeatedly steps through the list, compares adjacent pairs, and swaps them if needed. After each pass, the largest unsorted element bubbles to its correct position.
Q13.MEDIUM

Which sorting technique requires extra space proportional to the data size?

Merge sort requires O(n) extra space for the temporary arrays used during merging. Most in-place sorts like quick sort and heap sort use only O(log n) or O(1) extra space.
Q14.MEDIUM

Compare the time complexity of selection sort and insertion sort in the best and worst cases.

Selection sort is always O(n^2) in both best and worst cases. Insertion sort is O(n) in the best case (already sorted) and O(n^2) in the worst case.
Q15.HARD

Prove that the best-case time complexity of quick sort is O(nlog⁡n)O(n \log n)O(nlogn).

In the best case, the pivot divides the array into two nearly equal halves. The recurrence is T(n)=2T(n/2)+O(n)T(n) = 2T(n/2) + O(n)T(n)=2T(n/2)+O(n), which by the master theorem solves to O(nlog⁡n)O(n \log n)O(nlogn).
Q16.MEDIUM

What is external sorting and how does it differ from internal sorting?

External sorting is used when data is too large to fit in main memory and must be stored on disk. Internal sorting works entirely in main memory and is generally faster.
Q17.MEDIUM

Why is the stability of a sorting algorithm important? Give one application.

Stability preserves the relative order of equal elements. It matters when sorting records by one key after another, such as sorting employees by name within departments.

Searching

2 questions
Q18.EASY

Which searching method has the best average-case complexity?

Hashing gives O(1) average-case search time. Binary search gives O(log n) but requires a sorted array.
Q19.EASY

What is the advantage of binary search over linear search?

Binary search runs in O(log n) time compared to O(n) for linear search. However, it requires the array to be sorted beforehand.

Asymptotic Notation

1 question
Q20.MEDIUM

Define f(n)=O(g(n))f(n) = O(g(n))f(n)=O(g(n)) and give an example.

f(n)=O(g(n))f(n) = O(g(n))f(n)=O(g(n)) means there exist positive constants ccc and n0n_0n0​ such that f(n)≤c⋅g(n)f(n) \le c \cdot g(n)f(n)≤c⋅g(n) for all n≥n0n \ge n_0n≥n0​. For example, 3n2+2n=O(n2)3n^2 + 2n = O(n^2)3n2+2n=O(n2).

Hashing

6 questions
Q21.EASY

What is the ratio of items present in a hash table to the total table size called?

It is called the load factor, usually denoted by α\alphaα. It measures how full the hash table is and affects collision frequency.
Q22.MEDIUM

What is linear probing and what problem can it cause?

Linear probing resolves collisions by checking the next slot sequentially until an empty one is found. It can cause primary clustering, where occupied slots group together and slow down future insertions.
Q23.MEDIUM

Why is hashing called a heuristic search method?

Hashing uses a hash function to guess the location of a key directly, rather than following a deterministic comparison path. Its performance depends on the quality of the hash function and load factor, making it probabilistic in nature.
Q24.MEDIUM

What is the primary advantage of hashing over deterministic search algorithms?

Hashing provides average-case O(1) search time, which is faster than O(log n) for binary search or O(n) for linear search. It achieves this by computing the index directly from the key.
Q25.MEDIUM

What is a collision in hashing and name two resolution techniques?

A collision occurs when two different keys hash to the same index. Two techniques are chaining (storing colliding elements in a linked list) and open addressing (linear probing, quadratic probing, or double hashing).
Q26.MEDIUM

Why should a good hash function be simple?

A simple hash function computes quickly, keeping the constant factor of O(1) lookup small. A complex function may reduce collisions but adds computation cost that defeats the purpose of fast access.

Binary Search Trees

2 questions
Q27.EASY

What is a binary search tree (BST)?

A BST is a binary tree where for every node, all keys in the left subtree are smaller and all keys in the right subtree are larger. This property allows search, insertion, and deletion in O(h) time where h is the height.
Q28.MEDIUM

A BST is built by inserting 50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24. How many nodes are in the left subtree of the root?

The root is 50. All keys less than 50 go to the left subtree: 15, 5, 20, 3, 8, 37, 24. That gives 7 nodes in the left subtree.

Binary Trees

1 question
Q29.HARD

Prove that in any non-empty binary tree, the number of leaves n0n_0n0​ equals the number of degree-2 nodes n2n_2n2​ plus 1.

Let nnn be total nodes, n1n_1n1​ degree-1 nodes. Edges =n−1=n1+2n2= n-1 = n_1 + 2n_2=n−1=n1​+2n2​. Also n=n0+n1+n2n = n_0 + n_1 + n_2n=n0​+n1​+n2​. Substituting gives n0=n2+1n_0 = n_2 + 1n0​=n2​+1.

Threaded Binary Trees

1 question
Q30.MEDIUM

What is a threaded binary tree and what is the right NULL link of a node replaced with?

A threaded binary tree uses NULL pointers to store traversal links, called threads. For in-order threading, the right NULL link of a node is replaced by the address of its in-order successor.

AVL Trees

2 questions
Q31.MEDIUM

What is an AVL tree and what is the maximum allowed height difference between subtrees?

An AVL tree is a height-balanced BST where the balance factor of every node is -1, 0, or 1. The heights of the two subtrees of any node never differ by more than 1.
Q32.HARD

What is the maximum possible height of an AVL tree with 7 nodes?

The minimum number of nodes in an AVL tree of height h follows N(h)=N(h−1)+N(h−2)+1N(h) = N(h-1) + N(h-2) + 1N(h)=N(h−1)+N(h−2)+1. With 7 nodes, the maximum height is 3.

Graphs

3 questions
Q33.EASY

Which data structure is used for breadth-first traversal of a graph?

BFS uses a queue to keep track of vertices to visit next. It explores all neighbors of a vertex before moving to the next level.
Q34.MEDIUM

What is a bipartite graph and how can you test if a graph is bipartite?

A graph is bipartite if its vertices can be divided into two disjoint sets such that every edge connects a vertex in one set to the other. You can test it by BFS/DFS coloring: color a vertex, then alternate colors for neighbors; a conflict means it is not bipartite.
Q35.MEDIUM

What is a spanning tree and describe Kruskal's algorithm briefly.

A spanning tree of a connected graph is a subgraph that includes all vertices and is a tree. Kruskal's algorithm sorts edges by weight and adds them one by one using a disjoint-set (union-find) to avoid cycles until n−1n-1n−1 edges are chosen.

Recursion

1 question
Q36.MEDIUM

Write a recursive algorithm for the Tower of Hanoi and state its time complexity.

Move(n, source, auxiliary, destination): if n=1, move disk from source to destination; else move(n-1, source, destination, auxiliary), move disk, move(n-1, auxiliary, source, destination). The recurrence T(n)=2T(n−1)+1T(n)=2T(n-1)+1T(n)=2T(n−1)+1 gives T(n)=O(2n)T(n)=O(2^n)T(n)=O(2n).

Frequently Asked Viva Voce Questions

High-priority theoretical and lab evaluation questions typically tested by MAKAUT external examiners.

Related Course Resources

PYQData Structures & Algorithms Solved PYQs
Open resource
IMPORTANTData Structures & Algorithms Important Questions
Open resource
HUBData Structures & Algorithms Subject Overview
Open resource
SYLLABUSData Structure & Algorithms Syllabus & Handouts
Open resource

On This Page

16 Units
Introduction to Data Structures2
Arrays and Linked Lists1
Linked Lists2
Stacks and Expression Conversion2
Stacks1
Queues3
Sorting6
Searching2
Asymptotic Notation1
Hashing6
Binary Search Trees2
Binary Trees1
Threaded Binary Trees1
AVL Trees2
Graphs3
Recursion1