0 ratings 0% found this document useful (0 votes) 871 views 31 pages Dsa Old Question Collection
The document outlines examination questions for a Data Structure and Algorithms course at Pokhara University, covering various topics such as Abstract Data Types, expression conversions, queue implementations, tree structures, sorting algorithms, and graph representations. It includes specific tasks like writing algorithms, explaining concepts, and providing examples in programming languages like C or C++. The exam requires candidates to demonstrate their understanding of data structures through practical applications and theoretical explanations.
AI-enhanced title and description
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save dsa-old-question-collection For Later
fo POKHARA UNIVERSITY
Level: Bachelor Semester: Fall Year — 2021
Programme: BE Full Marks: 100
Course: Data Structure and Algorithms Pass Marks: 45
Time —: 3hrs.
Candidates are required to give their answers in their own words as far
as practicable,
a The figures in the margin indicate full marks.
. Adtempt all the questions.
- 1. a)/Define Abstract Data type with example. Explain which data structure
"are suitable for the following problems with proper reasons
i, Evaluating the arithmetic expression = _\~.
ii, Process scheduling by operating systems.
“iii. Developing the social networks.
2 bY Write the advantages of Postfix expression over the Infix expression,
‘while processing by computer >-tem. Convert the given expression into
Postfix expression showing, content of stack at each step.
on ASBECID EFF G*HELS) S
2a) Write algorithms to en-queue and de-queue in a circular queue.
b)/ What is the advantage of an array over linked list and what is the
advantage of linked list over an array? Implement a simple singly linked
list with three nods containing data 11, 22 and 33 using C or C++ code.
3 FO) Write algorithms for push and pop operations on a stack using linked ist
implementation. (= ee
p/Airie algorithms to inset and delete a node at tie end of singly linked
ee
TS
‘xplain the necessity of balancing a tree.. How are nite four different
rotations applied to rebalance the AVL tree? Explain with example.
snerate the Huffman Code for the following character with the given
frequency.
Character a b c d e
Frequency] 8 6 3 4 15w
2) Explain the insertion Sort with an appropriate example. Also state its 7
time complexity,
b) Whatis, collision in hashing? What are
in hashing? Explain about Separate ch
a) Define graph and digraphs, Explain A
with examples in undirected and
») Define the mininjum spanning’ tree,
ing the minimum
Write short notes on: (Am
a) TOH Problem
°c). Bigo Notation
2 e
‘Spanning tree,
ry two)
'®) Divide and conquer algofithm
the collision resolving techniques
djaceney matrix representation oO ai
directed graph.
a
Explain Kruskal’s algorithm for
eePORHARA UNIVERSITY
2 3: Bachelor Semester + Year :2020
Pogemiebe : Fal Mots 100
‘Counse:Datn Structure ancl Algorithm J Pass Marks: 45
Time: Shs.
Candidates are required ta give their answers in their own words ex far
‘a practicable.
The figures in the margin indicate full marks,
Atienypt all the questions,
do you need data structure? Data Structure is an abstract data
fype, Do you agree with this Statement? Ifo, explain with example,
) Why do you convert infix expression to postfix expression? Explain
ian do you use stack to convert the following infix expression into
‘postfix: A+(B*C-(D/E*F) *G)*H
‘Where “is power opemtor.
8), Wate the shontcomings of linear queue? How are they solved in
ular queve? Write algorithms for enqueue and dequeue opemations
in circular queue,
Loy What is the edvantage of doubly linked fist over singly linked list?
rite algorithms to insert and delete a node at the beginning of singly
jnked fst
2) / Write a simple ‘program in C or C+ to create a singly linked list
cohtaining three nodes. The first node stores 11, second node stores 22
and third node stores 33. Also display the data of nodes.
6) Wat6the cases in which you will use iteration and wecusion. Beplain
fow you will solve the Tower of Hanoi problem.
4) Mhy do youneeda balanced tee? Create an AVL tree fom the given
Set of values: 57,13,9,6,3,14,10,4.
5) What is the advantage of vatiable length encoding? Constiuet
(hn wee and generate code for the following symbol with ther
juency given below.
[smoi Te [o Te Te yTuy™
[F quency | 32 | a2 7 | 42 | 2
oe
MO ekplain how you-use divide and conquer stmatogy to sort the Kollowing
fusing quick sort: 7,9,43,12,56,90,3,8,50.
Also write the best, average and worst case time complexity of quick
sort forsimple partition case.
, &) Whats the purpose of hashing? For given input (2, 17, 49, 37, 25, 67.
82, 4,9, 3) and a hash function h(x) =x mod 10 show the resulting:
i, Hash ible using linear probing
* i, Hash table using chaining
6. a) Whats directed and undirected gmpb? Explain adjacency matrix and
——~ adjacency list representation of graph, with suitable example.
6) Write Dijkstm's Algorithm. Find the shortest path from P to U using,
‘Dijksima’s algorithm.
7. Weite short notes on: (Any two)
a) Binary search
b) Kins! kal’s Algorithm:
¢) Big O Notationa
; ~a)—~-Write-an-algorithm-for-insertion.
POKHARA UNIVERSITY
Level: Bachelor Semester: Fall Year 22019
Programme: BE. Full Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time : Shrs.
Candidates are required to give their answers in their own words as far
as practicable
The figures in the margin indicate full marks
Auempt all the questions.
a) Give ADT of matrix. Show a sample product function to find product
of two matrices.
b) What is the condition of stack overflow & stack underflow? Write
down the module for stack pop & push operation.
a) What are the limitations of circular queue? Write an algorithm to
enqueue and dequeue in circular queue.
b) Write a module function to insert and delete an item in the queue in
circular representation. You must state assumption clearly that are
needed.
a) Define recursion. Illustrate the steps to solve Tower of Hanoi (TOH)
problem with its solution for 3 discs.
b) Explain Algorithm and its types.
a) Construct a Binary search tree after inserting the following values.
12 5 1S 13 17 3 it 1 o
Show your binary tree after deletion of
if 1S
b) What is the benefit of having a binary tree that is Height Balanced?
Explain all possible rotations while constructing a height balanced tree
using example for each.
the singly Linked list.
b) Construct a heap from the following data and illustrate heap sort.
56, 103, 88, 24, 77, 89, 53, 47, 90.
a) What do you mean by transitive closure of the graph? How wars
hall’s algorithm is used to find the transitive closure of a graph.
Clarify with suitable example.
and deletion of the node in the end of _
7
8
7
+
7
8way
What do you mean by spanning tree? Ex;
find the shortest path in graph with suitabl
hort notes on: (Any two)
2s
®) Explain efficiency of Sorting
b) AVL Tree
©) Link list as an ADT
plain Dijkstra’s algorithm to
7
le example.POKHARA UNIVERSITY
Level: Bachelor Semester: Spring Year 22019
Programme: BE Full Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time 3hrs.
Candidates are required to give their answers i their own words as far
as practicable.
The figures in the margin indicate full marks
Antempt all the questions.
a) Differentiate Linear and non-linear data structures with their traversal
methods.
b) Define infix and postfix expression. In an application, the client
request you lo process their data in a particular format. The format
states that the in the data count of 1000, first data entered in the
application is the last data that comes out of the application. Write
down the insert & delete mechanism for manipulation of data.
a) What is double ended queue
circular queue for both insertion & deletion approach
b) What is the best condition of the recursiv
explicit equation of ToH using Recursive Relation.
a) Let LIST be a linked list in memory.
given value k to each clement in LIST.
b) Define list. List down the operations pel
dynamic implementation of list with suitable example.
a) Suppose the following letters
search tree: U, V, P, Q, M,N, 0, R K, W,C, D.
i, Find the final tree T and
Find the post order traversal of T
ii.
Igorithm. Show your ow
b) Explain the Huffman al
algorithm.
~ay _Distinguish-linear and-binary- [Link] step
given data 7, 13, 36, 42, 43, 46, 85.
b) Write a program to sort the set 0!
bubble sort method.
a) Explain various collision
exainple.
b) Define graph
pijkstra’s algorithm
example of Huffman
resolution techniques
traversing? Find the shortest Pi
) Write down the algorithm to implement
¢ function? Derive the
Write a procedure which adds a
formed in list. Explain
js inserted in order into an empty binary
s-to-search.46 from-the-
f strings in ascending order by using
in hashing with
ath from @ t0 B using
8
—1L——&POKHARA UNIVERSITY
Level: Bachelor Semester:
! a Semester: Fall Year 2018
eee Dat BE Pull Marks: 100
‘ourse: Data Structure and Algorithm Pass Marks: 45
Time : Shrs.
Candidates are requir
quired to give their answers in their ow!
ee own words as far
The figures in the margin indicate full marks
Attempt all the questions.
Define ADT with example. What are the data structures used in the
following areas: Print jobs in computer, Network data model &
Hierarchical data model?
b) What is the advantage of postfix expression over infix expression? 8
Evaluate the given expression using prefix notation.
A*(B+C)-(D/E)
(Assume A = 5, B= 6, C=2, D=12 and E=4)
linear queue and circular queue. Writean 8
a)
a) Write differences between
algorithm for insert and delete operations for circular queue.
1
b) How many steps are required to solve TOH problem? Write the steps
to solve TOH problem for 4 discs giving pictorial illustrations.
a) Differentiate between static and dynamic list. Write an algorithm to
insert a node at the end doubly linked list.
b) What is circular linked list? Write an algorithm for push and pop. g
operations on Stack using linked list.
a) Suppose the following list of letters is i
binary search tree. JRDTGEAMH
perform different tree traversals.
nserted in order into an emply
FQUB. Find the final tree and
tree, Create an AVL tree__g——
nto repre .
s. 3,55) 1,8,4,1,12,7,
5) Write a structure definition
from the given set of value:5. Trace quick sort for ng set of values. :
quick sort Ie following S!
a) Trace qui
i ision resolut
43,16 1 80.38 a techniques used for collision resolution
ision, What are
b) Define collision.
in hashing. Explain with e
ning tree Oo:
What do you mean by spanl e
9 spanning tree of the following graph using
le. :
oa f graph? Find the minimal 7
Kruskal’s algorithm.
b) Explain with suitable example, BFS and DFS traversal of a graph.
7. Write short notes on: (Any two)
a) Divide and Conquer Algorithm
b) Radix Son
c) Worst Case Complexity
8
2x56.
b)
a)
POKHARA UNIVERSITY
Level: Bachelor Si
1 Spagh
Programme: BE inesier erin Pad a
Course: Data Structure and Algorithm omer s
Time + Shrs.
Candidates are require to gi
quires to give the: in thei
ca prenieable give their answers in their own words as far
The figures in the margin indicate full marks.
Attempt all the questions.
Define abstract data type? Justify the statement “Data Structure is the 8
backbone of software programming"
Write the advantages of Postfix expression over the Infix expression.
Convert the given expression jnto Postfix expression showing the
step. (A +B*C/D)+E*F-(G*H+1-J).
content of stack at eac
recursion and iteration. Write
recursive 7
Differentiate between
mechanism (algorithm) for solving Tower of Hanoi problem.
b) Explain the advantages of doubly linked list implementation. Write 8
algorithm for insertion and deletion in stack as linked list.
balancing AVL tree after 7
a)
b) Construct a BST from t
le the different cases of
lates the property.
he following data and show VLR, LVR,LRV 8
10,17,12,1 1,20,18,25,20,8,22,23.
Explain with examp
inserting a node that viol
and RVL traversals 14,
a) Define Queue. Mention the primitive operations ‘of Queue and write 8
the module for enqueuer and dequeuer in Circular Queue
b) Generate the Huffman Code and also draw the Huffman tree for the 7
following unique Character “pOKHARAUNIVERSITY”.
the algorithm for quick sort. 1
8
a)
b)
hashing? What are the collision resolving.
arate-chaining--—
What is sorting? Write
‘What is collision in
—techniques 1 hashing? Explain about sep: g ;
Define graph and digraphs. Explain Adjacency matrix representation 8
of graph with examples in undirected and directed graph. ,
mum spanning tee. Explain Kruskal’s algorithm for ¥
Define the mini
finding the minimum spanning tree.ij
Write short notes on: (Any two)
a) TOH problem
b) Deterministic and non-deterministic algorithm
¢) Static vs dynamic lista)
)
a)
b)
a)
b)
a)
b)
a)
POKHARA UNIVERSITY
Level: B: 5
peaihnihe BE Semester: Fall Year +2017
Pull Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time : Shrs.
Candidates are requi
s quired to give their “1 ei s
peer 8g answers in their own words as far
The figures in the margin indicate full marks.
Attempt all the questions.
What is Abstract Data Types (ADT)? Explain the different primitive
operations to be performed on the data structures.
How data structure is different from data types? Explain the meaning
of linear and nonlinear data structure with suitable example.
List the applications of stack in computing as well as non-computing
world. Write down the condition to check whether the clement in
linear queue is last element or not, Also mention how do you find the
number of elements present in any queue?
Write an algorithm to convert infix expression to post
Convert the following postfix expression into infix expression:
fix expression.
abe-+de-fg-h+/*
What is double ended queue? How does circular queue overcome the
gorithm for traversing in
shortcoming of linear queue? Write an al
circular queue.
d disadvantages of Linked list? Write an
What are the advantages an
fied position of singly linked list.
Jete a node in speci
linked list? Explain with suitable
f two polynomials using linked list.
ed in an order.
algorithm to del
What are the applications of
example to perform the addition o:
Construct a BST from the following elements insert
39, 45, 30, 60, 42, 35, 25, 32,
“fraversals. - core a
What is weig
following words are inserted
FIZZA, IMRAN, NAVIN, LO
How recursion is different from iteration.
1
m the AVL algorithm for
nt balanced tree? Perfor
in an empty tree. BRUJESH,
in an order
VELY, PRITY, SAMIT
Present your argument with
44, Also perform different tree
w. eis ——
suitable example for following statement: es cries,
using recursion is not efficient as compare with iteration”. ae
What is stable and unstable sorting? Trace the quick sort alg org
b)
7
following unordered list.
25, 30, 18, 16, 45, 40, 60, 20, 10, 7, 30, 100, 12, 14.
Compare set, matrix and linked list representation of graph. What are
the difference between traversing in graph and traversing in tree?
a)
8
Explain with suitable example.
b) 76, 26, 37, 59, 21, 65, 75, 49, 11. From above data, store the values
into hash table with 10 positions, using division method (key% table
size) of hashing and the linear probing and chaining method for
resolving collision.
Write short notes on: (Any two) 2x5
a) Heap sort
5) Transitive closure
¢) Big OH notationPOKHARA UNIVERSITY
Level: Bachelor
Programmes BE Semester: Spring Year :2017
Course: Data Structure and Algorithm sae a
Time : Shrs.
Candidates are requ i
ae pioctcable quired to give their answers in their own words as far
The figures in the margin indicate full marks
Attempt all the questions.
a) Why data structure is needed? Explain the advantages of abstract data
typing.
b) Write an algorithm to evaluate an arithmetic expression in Postfix
string. Apply the algorithm to evaluate; AB + C - BA + c$ =
(assume A = 1, B =2,C=3).
a) Write an algorithm to insert an element into the queue and to delete an
item from queue.
b) Define doubly linked list. Explain the advantages and disadvantages
of linked list over array.
2) Write a program to implement a stock using array. (you can use any
programming language such as C or C++ or Java)
b) Write recursive function/algorithms for Binary Tree Traversals.
a) Define an AVL tree. Why do you balance a tree? Explain with an
example.
b) Why is quick sort better than other sorting algorithms? What might be
the cases where quick sort isn’t better?
a) Given input {1, 16, 49, 36, 25, 64, 0, 81, 4, 9} and a hash function
h(x) =X mod 10.
i “Draw Hash table using open-addressing — ge: se te
ji. | Draw Hash table using chaining
b) What is external sorting? Write a C functi
positive integers using bubble sort.
th? Write Disjkstra’s shortest path
a) What do you mean by Shortest Pal
algorithm and explain the algorithm with suitable example.
jon to sort a given array of5) Explain adjacency matrix and adjacency list representation of
using an example
7. Write short notes on: (Any two)
a) Recursion and ToH
b) Big O Notation
c) Minimum Spanning Tree
8raphPOKHARA UNIVERSITY
Level: Bach :
Programme: ey Schrcnt@ri Walt Year + 2016
Course: Data Structure and Algorithms tied i”
s Marks: 42
‘Time the
Candidates are requii
quired to gi ir ans ii
as prdcticable ‘0 give their answers in their own words as fur
The figures i init
figures in the margin indicate full marks.
Attempt all the questions.
Discuss the concept of data structure. Explain various ways of 7
representing rational number as an ADT.
Write an algorithin for conversion of infix to postfix expressiat
Convert the following infix expression to postfix in tabular form
(a-bie$d)te(F2*h)
Differentiate between stack and queue. How do you insert and delete
acircular queue? Explain with an example.
an element in
list. Write an algor ith to
Differentiate between static and dynamic
a contiguous list.
insert an element into
Explain four types of dequeue will *
Define Enqueve and Dequeue.
suitable example.
What is recursion? WI!
the difference between recursio)
at are its advantages and disadvantages? Give
"and iteration by taking reference of
factorial function.
Design a Binary tree whose pre-order and in-order traversal sequences?
are FAEKCDHGB and EACKFHDBG respectively,
What is height balanced tree? Insert 3,2,1,4,5,0.7 in an emply AVL8 3
tree.
Define Hash Function. Suppose, In a company with its 68 employees,
ployee has 4 digit ‘employee number and. also assul
100 address starting, from 00, 01, 02, 0
mbers are 4205, 3605, 7777, 8282, 7626, 0234,
1002. Perform division me!
thod, folding, mettod
hod. Allocate the desired result in
nel Sa
2.
_every emmy
memory table has
The employee nu
2522, 5228, 5175,
and mid square met
memory
1Explain selection sort. Sort the following list using heap sort:
31,41,5,9,36,53,58,97 ‘
Explain Warshall’s algorithm to find the transitive cl
diagraph. For the adjacency matrices A given below
draw the corresponding digraph
find the matrix T of the transitive closure using the digraph
implementation of Warshall’s algorithm.
OT 0-0
0010
& Osure of
ii,
AS
1000
b) Define shortest path algorithm. Find the shortest path from C to E
using Dijkstra Algorithm,
Write short notes on:
a) Deterministic and Non-Deterministic algorithm
b) Quick Sort
c) Tree traversal.
(Any two)b)
we
a)
b)
a)
b)
a)
b)
6 a)
b)
__ First Traversal of graph._——-——
POKHARA UNIVERSITY
Level: Bachelor
Programme: BE
Course: Data Structure and Algorithm.
Semester: Spring Year —: 2016
Full Marks: 100
Pass Marks: 45
Time 3hrs,
Candidates are required to yi
as praenlceite equired to give their answers in their own words as far
The figures in the margin indicate fiull marks
Attempt all the questions.
Differentiate between 4.
: a type and data structure, What are the two /
parts of ADT definition? Explain.
Differentiate between infix, prefix and posifix expression. Write an 8
algorithm to evaluate an arithmetic expression in Posttix string.
Define Circular Queue. Write an algorithin to add and delete an Hem 8
in the circular queue.
List basic five operations of linked list. Write code for Inserting new
node at beginning of the list.
What are the advantages and disadvantages of linked list 8
implementation over array implementation? Write algorithm tor
engueue and dequeue operations on Queue using linked list.
Explain B+ trees giving some of its application. Write the algorithm to 7
delete an element from B+ tec.
Mention advantages and disadvantages of recursive algorithms over
ws
iterative solutions.
Trace quick sort algorithm for the data: 10, 22, 31, 4, 15. 28,17, 6 10
Discuss the efficiency of binary searching.
Define hashing and collision. iHustrate three types of collision 10
resolution techniques with an example.
Differentiate between Graph and Tree. Write an algorithm for Depth-
What is minimum spanning tree? Explain Kruskal’s algorithm to get 8
minimum cost spanning, tree of following graphWrite short notes on: (Any two)
a) Priority Queue
5) Mean Vs Max Heap
¢) Big O notation
SF ae ane
eT) tage
+ NGIT Go)
WS iS ler
SevFz Reyes
legea)
b)
a)
b)
a)
b)
POKHARA UNIVERSITY
Level: Bachelor
Programme: BE
Course: Data Structure
Semester: Fall Year 2015
Full Marks: 100
Pass Marks: 45
Time 2 Shrs.
and Algorithm
Candidates are required to
; give their answe
as potrtlbale give their answers in their own words as far
The figures in the margin indicate full marks
Attempt all the questions,
Differentiate ADT and C++ class. Write an ADT for natural numbers. 7
Trace the algorithms to convert postfix expression with the following
infix expression
((A+B)-C*D/E)$*(H-I)*F+G
Evaluate postfix expression obtain from above with the following
values for
A=4,B=2,C=4,D=3,E=8,F=2,G=3,H=5 and I=1.
What are the difference between stack and queue? Write enqueue and &
dequeue algorithm of circular queue.
What is doubly linked list (DLL) and Circular Linked List (CLL)? 7
Represent the following polynomial equation using singly linked list
P(x,y,2)=3x?yz — Sx’y? + Sx?y? + Byx?z—4xy’z’ + 2x’yz
State the advantage of a linked list over contiguous list. Write the 8
steps involved in deleting an item in a contiguous list.
How the representation of data in memory is cheaper using linked list. 7
than in array? Write an algorithm to search an elemerit and insert a
node at the specified position in a single linked list. /.*
7
‘What is tree traversal? Explain preorder, inorder and postorder tree
traversal by constructing expression tree of the given expression: b*b-
4tate
How does the Huffman algorithm work? Explain with a complete
example.
Sort the following data using merge-sort al
88, 60, 11, 80, 20, 50, 44, 77.
What is hashing. Explain in detail about the tec!
Igorithm. 66, 33, 40, 22,55, 7
hnique used for 8collision resolution,
& a Define graph and diagraph?
LetG bh raph represented by this adjacently list
Ver i ___| Adjacent
S ,
B c
c B
2 AB
: CD,
f E
|
i Draw,
i, *IsGa directed graph? «
iii, sg Weakly connected?
Give the adjacency matrix for G,
b) Define graph, connected graph and spanning tree, Perform the
topological son from the following raph,
7. Write short notes on: (Any two)
a) Game Tree,
b) Recursion Versus lteration,
c) Bigo Notation,
2x53
POKHARA UNIVERSITY
Level: Bachelor Semester: Spring Yea
Programme: BE Fi alt te
‘Course: Data Structure and Algorithm Pact Mas is
Time 3hus.
Candidates are requit i
quired to give their an ry i)
ee g aswers in their own words as far
The figures in the margin indicate full marks
Attempt all the questions.
a) "To write an efficient program, we should know abou data structure. .
Explain the above statement.
b) What is ADT? Explain different primitive operations th
perform on data structures:
c) List the applications of stac!
pat we can
k in computing as well as non-compuling
world.
4) What is infix, prefi
infix expression into postfix expression sh
x and postfix expression? Convert the following
owing the content of stack
in each step
peat(BtC-(D/ESF)*G)*H
b) Compare circular queue with linear queue Write Enqueue and
Dequeue algorithm of circular queue. ;
a) How dynamic list is different from static list? What are the primitive
operations that we can perform in list? Explain with suitable
example.
b) What is doubly Ii
Write an algorithm to insert 4 node in spe
linked list.
Define BST. Construct a BST using the following data
LUN LY. , 8, 1, T, ¥, O, F, P, O, K, H, As R, A.
Also Perform pré-order, in-orderand post order traversal
b) Generate the Huffman code for the symbol A, B, C, D, E, F with the
probability of occurrence are 0.2, 0.28, 0.2, 0.16, 0.12, 0.04
Also construct Huffman tree.
ced to balance the tree? Perform the balancing algorithny
1
iked list (DLL) and Circular Linked List (CLL)?
ified position of doubly
a)
respectively.
a) Why do wen
8
4b)
a)
b)
according to AVL for the following sequence ee =:
Differentiate bubble sort with selection sort. Explain e iVide ang
Conquer approach in quick sort algorithm. Trace the algorithm to son
the following unordered list. 25, 30, 18, 16, 45, 40, 60, 20, 10, 7, 30,
100, 12, 14, ost
e between traversing in graph and
Define graph. What are the differen.
traversing in tree? Explain with suitable example.
Define Hash Col
tesdlving collision,
Write short notes on: (Any two)
a)
b)
c)
Recursion ys Iteration
Deque
Serial and Parallel algorithm.
2x57
ity POKHA
a RA UNIVERSITY
17% 8
: ” bee BE yee mi
ang (rae Data Structure and Algorithm Pase Marke 4
. Fie Bhs,
, 2 os iat ay eas aon their answers in their own words as far
| The figures in the margin indicate full marks.
; Attempt all the questions.
Define data structure. Explain the different operations to be performed
a)
on data structure,
b) Write the algorithm to convert the infix expression to postfix
expression to postfix expression using stack implementation. Evaluate
the following expression
ABC/- DE* F -*(Where A=6, B=5, C=2, D=3, E=4 and F=1)
2. a) Write an algorithm to insert an item in circular queue in array
implementation. Write assumptions you need?
b) Define list. Describe merits of linked list over contiguous list. Write
: an algorithm to insert an item in a static list.
3. a) Differentiate between singly linked list and doubly linked list. Write
an algorithm for push and pop operations on stack using linked list.
Construct a binary tree from the following inorder and preorder
b)
sequence. :
Preorder: FAEKCDHGB
Inorder; EACKFHDBG
4. a) Write an Algorithm to build an Huffman Tree. Construct a Huffman
tree for the following data item and Frequency
Data item ~~~ fA [B-fe— PE——]#---6—
Frequency [22_[s Tu 19 [2 it [25 15
b) Sort the following data by heap sort method.
40, 32, 75, 20, 65, 48, 88
a) Define Selection sort. Trace Quick sort algorithm for the data:
I
7
8
x
3+5
245hy
b)
Write short notes 01
4) Bigo Notatior
bj
co
1 AR, 47, 12, 92, 86, 33
ising Technique
Search using Hriary search Techniq
neh 275 and 727,
i ‘i inimum s
Detine greedy algorithm. Find minimur
araph using Kruskal's algorithm,
Define Braph travers,
al, Differentiate between
example,
H.
n: (Any two)
n
Recursion Vs Iteration,
ash Funetions and hash tables,
panning tree for the Biven§
| evel: Bachelor
b)
a)
a)
b)
a)
b)
a)
Pp.
OKHARA UNIVERSITY
Semester Spring
programme: BE Year 2014
course: Data Structure and Algorithm el Matha: 100
Pass Marks: 45
Time 3hrs.
Candidates are required to give
i their answe
as practicable, ene
rs in their own words as far
The figures in the margin indicate full marks
Attempt all the questions,
Justify {i Statement "Data Structure is the backbone of software
programming". What is ADT?
Explain the basic operations of stack. Write an algorithm for insertion
and deletion of an element in a stack. Also mention the condition for
overflow and underflow ina stack.
What is infix, prefix and postfix expression? Convert the following
infix expression into postfix expression showing the content of stack
in each step.
P=A+(B/C-(D*ESF)+G)*H
Compare circular queue with linear queue. Write enqueue and
dequeue algorithm of circular queue.
What are the advantages and disadvantages of linear linked list? Show
an algorithm to insert an element at the end and at specified position
of the single linked list.
What is doubly linked list (DLL)? How does it differ from circular
linked list (CLL).Explain with appropriate example.
Differentiate recursion with iteration. Write down the algorithm to
solve the tower of Hanoi using recursion.
Generate the Huffman vode for the symbol A, B, C, D, E, F with the
probability of occurrence are 0,2, 0.28, 0.2, 0.16, 0.12, 0.04 =
respectively. Also construct Huffman tree.
Write the steps required to delete a node form a Binary Search Tree
(BST). Re-construct the resulting BST after deleting the node 6 from
the following BST.b)
What is sorting? Explain the divide and conquer approach in quick
Sort algorithm. Trace the algorithm to sort the following unordered
list. 40, 20, 10, 80, 60, 50, 7, 30, 100,
Define graph. What are the difference between traversing in graph and
lraversing in tree? Explain with suitable example.
66. 47, 87, 99, 126, 140, 145, 153, 177, 285, 393; 395, 467, 566, 620,
735. From above data, store the values into hash table with 29
Positions, USING division method (key % table size) of hashing and the
linear Probing method for resolving collision
Write short Notes on: (Any two)
ay
b)
b)
c)
Spanning (ree,
Deque.
Serial and Parallel algorithm
2x5P.
OKHARA UNIVERSITy
wel; Bachelor Sen
amie: Bi Nester; [al]
course: Data Structure and Algorithm
Year 2013
Full Marks: 100
Pass Marks: 45
Time 3hrs,
Candidates are requi
“ quired to give their answers in th
oF précticable in their own words as far
The figures in the margin indicate full marks,
Attempt all the questions,
a) What is the di;
) difference between data type and data structure? How do
you represent Rational number as an ADT?
Define stack as an ADT. Enlist any five applications of stack. Convert
b)
the given“ expression into postfix expression showing the content of
stack at éach step:
(A+B)$(C*D)-E
a) Discuss the merits and demerits of contiguous list and linked list.
Write algorithms to insert and delete a node in queue implemented in
linked list.
b) “A function or a object calls itself”. Explain this statement using idea
behind it, Give recursive algorithms for Fibonacci term and TOH
problem.
a) Write down C module t2 insert an element before, between and after
node of singly linked list.
b) What is AVL Tree? Determine the pre order, in order and post order
traversal for the following binary tree.
a
i (a a
Pe
eSa)
b)
a)
b)
a)
b)
adix sort is useful? Trace the
Why sorting is necessary and when f ;
following data using radix sort algorithm: 25, 57, 48, 37, 12, 92, 86,
33.
Define load factor, Given input { 1, 16, 49, 36, 25, 64, 81, 4, 9, 2} ;
and a hash function h(x) = x mod 10 show the resulting:
i, Hash table using quadratic probing.
ii, Hash table using chaining.
Define Big O Notation. What is parallel computing algorithm and 8
when parallel computing algorithm is preferred over the serial one?
Find the Minimum Spanning Tree and its weight of the graph using 7
Kruskal’s algorithm:
Write Dijkstra’s Algorithm to find the shortest path. Explain the 8
algorithm with necessary figure.
Draw the Binary Search Tree (BST) for following string 7
“POKHARAUNIVERSITY” considering each character as
information of the node in a binary search tree. Also traverse the tree
in post-order, pre-order and in-preorder.
2x5
Write short notes on: (Any two)
a)
b)
c)
Warshall’s algorithm.
Stable and unstable sorting.
Dequee operation using linked list.WV
}
‘the i pachelor
86, 8M me: BE
Data Structur
ei 5 Ite ay ;
wo nd Algorithm | fi 2013
; Pp I Marks: i9g
85 Marks: 45
ciandicdates are required 19 giyy Time she
as practicable. 8M their ansyyeys inth :
i i) er
he figures in the ‘margin indieay OWN Words as fay
Pale full
suempt all the questions, Lull marks
3) What is data structure? Compare and
non-primitive data structure *g
b) Define stack. Convert the Biven expressioy
showing the content of stack at each step: estan
(A+B)*(CSD)-E/F ;
7. a) What isa benchie Of circular queue when compared to linear queue?
~ What are the basic operations in a queue? Write an algorithm for any
one of the operations.
b) What is a linked list? Write an algorithm to insert at the beginning of
rast between primitive and
the linked list. -
3. a) Why is doubly linked list used? Explain the implementation of a
doubly linked list.
een recursion and iteration. Write a
b) Compare and contrast betw'
recursive algorithm for generating Fibonacci sequence. a
1. a) Draw the Binary Search Tree (BST) for following string considering
each character as information of the node in a binary search tree. And
also traverse the tree in post-order, pre-order and in-preorder:
"TURE
b) a is used in AVL tree? Construct an AVL tree from
iy
ing data: Z
_____the following. 79,45,21,16,54
70,80, 90,1,5,89,9 15 ,
ing data:
dix sort, sort the given a i;
. bere wh RA, U, Ns bY. RSL TY -
what do." ‘hing? Explain about collision resolution
do you mean hasl
OT ea d in hashing.
technique use i
~Tree and its weight of the graph using
Find the Minimum Spanning
4 6
Prim’s algorithm
b) Explain about deterministic and non-deterministic algorithm in brief.
Also explain about Big-Oh notation with the help of suitable example,
7. Write short notes on: (Any Two) 2x5
a) Greedy algorithms
b) Bucket sort
c) Huffman algorithm.