Data Strctquestion
Data Strctquestion
3. Explain Asympto c Nota ons: Big O, Omega (Ω), and Theta (Θ) with graphs and
examples.
Arrays:
Linked Lists:
2. Write algorithms for preorder, inorder, and postorder tree traversal (recursive and
stack-based).
3. What is a binary search tree? Write an algorithm to search, insert, and delete in a
BST.
4. What are AVL Trees? Men on their advantages over normal BSTs.
1. Define a graph and explain its types (simple, directed, mul graph, weighted).
2. Explain the adjacency matrix and adjacency list representa ons of graphs.
Sor ng Algorithms:
o Bubble Sort
o Inser on Sort
o Selec on Sort
o Quick Sort
o Merge Sort
Searching Algorithms:
1. Differen ate between linear search and binary search with examples.
Arrays:
2. Derive the formula for address calcula on in row-major and column-major order.
Linked Lists:
7. What is a stack? Write opera ons using arrays and linked lists.
o Simple Queue
o Circular Queue
o Priority Queue
2. Explain:
o Preorder traversal
o Inorder traversal
o Postorder traversal
o Inser on
o Searching
o Dele on
o M-ary Trees
UNIT IV – Graphs
Sor ng:
o Bubble Sort
o Inser on Sort
o Selec on Sort
o Quick Sort
o Merge Sort
Searching:
Prac ce code for linked list, stack, queue, tree traversal, and sor ng.
BCA – Semester II
Instruc ons:
Illustrate your answers with neat diagrams and examples where necessary.
Q1. (a) Define data structure. Explain the classifica on of data structures with
examples.
(b) Explain asympto c nota ons – Big O, Omega (Ω), and Theta (Θ) with graphical examples.
(7 + 7 = 14 marks)
(b) Derive the address calcula on formula for 2D arrays in row-major and column-major
order.
(c) Write a program to insert an element in an array at a given posi on.
(4 + 4 + 6 = 14 marks)
Q3. (a) What is a linked list? Explain types of linked lists with diagrams.
Q4. (a) Define a stack. Explain array and linked list implementa on of stack.
(b) Convert the infix expression (A + B) * (C - D) into pos ix and evaluate it using stack.
(7 + 7 = 14 marks)
Q5. (a) Define a binary search tree (BST). Write an algorithm for inser on in BST.
(b) Perform inorder, preorder, and postorder traversal on the following tree:
markdown
CopyEdit
10
/ \
5 15
/\ \
3 7 20
(6 + 8 = 14 marks)
Q6. (a) What is a graph? Explain adjacency matrix and adjacency list representa ons.
Q7. (a) Write and explain bubble sort and quick sort algorithms with examples.
(b) Compare selec on sort, inser on sort, and merge sort based on me complexity.
(8 + 6 = 14 marks)
Q8. (a) What is hashing? Explain any two collision resolu on techniques.
(b) Write an algorithm for binary search and explain it with an example.
(6 + 8 = 14 marks)