Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 12

DATA STRUCTURE AND ALOGORITHMS

UNIT I and II Question Bank

Sr.
Unit I: Introduction to Algorithm & Program Design
No.
Sort following data using bubble sort & Insertion sort. Show all
Q.1 the steps and dicuss on time complexity.
20 5 18 7 21 6 (6) May 2014
Q.2 Explain the term Data Structure and its operations (6)
Q.3 What is time complexity of an algorithm? Explain with suitable
example. (6)
What will be output of following code? (6)
Justify your answer.
for(i=o;i<3;i++)
{
for(j=0;j<3;j++)
Q.4 { May 2013
a[i][j]=10 * (i+j);
printf(“%d”,a[i][ j]);
}
printf(“\n”);
}
printf('%d%d”,i,j);
Q.5 Write an algorithm for linear search technique. (6)
Q.6 Discuss the different phases of creating program. (6) May 2013
Q.7 what will be the output of following code? (6)
Justify your answer.
Void f(intx,int * p)
{
x =x +10 ;
* p = * p+x ;
}
void main( )
{
int a=10,b=20;
f(a, &b);
printf(“%d %d “,a,b);
DATA STRUCTURE AND ALOGORITHMS

}
Sort following data using bubble sort & Insertion sort.Comment
Q.8 on numberof comparisons & number of swaps /shifts required.
35 17 2 13 10(6)
Define a structure which can store real & imaginary parts of a
Q.9 complexnumber.Declare two variables of the types of this
structure. Store twocomplex numbers in them & Display them.
(4)
Explain following terminologies. (6)
Q1
(i)Data type
0 (ii)Data structure
(iii)Abstract Data Type.
Sort the following table of numbers using :
(i) Bubble Sort
Q1
(ii) Insertion Sort
1 AVBCDXP
Show every pass in detail.Define Time Complexity and write down Dec 2012
Time Complexity for the above sorting methods. [8]
Q1
Write pseudo ‘C’ algorithm for Binary search. [4]
2
Q1
Define ADT. Write down ADT of arrays. [4]
3
Q1
Write a function in ‘C’ to implement selection sort. [6]
4
Dec 2012
Q1
Define Recursive Function in ‘C’ and explain with example in
5 detail. [6]
Q1
Explain with example row major and column major storage
6 representation in two-dimensional arrays. [4]
Q1 Dec 2016
Write a C function with and without pointers to array for
7 checking whether the given string is palindrome or not [6]
Q1 Write a C function for binary search. Compare the time
DATA STRUCTURE AND ALOGORITHMS

8 complexities of Linear, binary and Fibonacci search [6]


Q1
Explain parameter passing by value and by reference with
9 example of swapping of two values [6]
Q2 Sort the following numbers using Bubble sort and Merge sort
75 15 58 -5 22 34 54 28 27 1 [6]
0
Q2
Sort the following data using Merge Sort and Selection Sort
1 142 317 45 222 187 [6]
What will be the output of the following code? Justify your
answer
for (i=0;i<4;i++)
{
For(j=0;j<4;j++) May 2017
Q2 {
A[i][j] =20*(i+j);
2
Printf(“%d”, a[i][j]);
}
Printf(“\n”);
}
Printf(“%d%d”,i,j); [6]

Write the following functions in c


Q2 1. STRCOPY() : to copy a string to another string using
array.
3
2. STRLENGTH() : to find length of string using array
May 2017
Note: Do not use standard library functions. [6]
Q2
Explain binary search algorithm with example. [6]
4
Q2 Dec 2017
What do you mean by recursive function? Explain with suitable
5 example [6]
Q2 Write a C function for insertion sort to sort integer numbers [6]
6
DATA STRUCTURE AND ALOGORITHMS

Q2
Explain with suitable example how do you pass structure
7 variable to a function [6]
Q2
What is pointer? What are advantages using pointer? Explain
8 pointer declaration and initialization with an example [6]

UNIT III Question Bank

Sr.
No. Unit III: Linked Lists

Singly Linked Lists: Concept, Linked List as ADT,


Representation of Linked list in Memory,Traversing a linked
01 list, Searching a linked list, Memory Allocation; Garbage Course learning
collection, Insertion intoLinked list, Deletion from a linked list, Objectives: 1,2,4
Header Linked List, Representation of polynomial,
CircularlyLinked list, Doubly Linked List.

Unit Objectives: On completion the students will be able to :


a. Understand advantages of dynamic data structure
b. Learn concept and Types of linked data structure.
02 a. Abstract Data Type and ADT of different DS.
c. Implement and Perform primitive operations on SLL, DLL .
d. Learn basics of CLL and GLL.

UNIT Outcomes:
03 1. Able to create SLL,DLL Data structures for real application
2. Able to understand Dynamic Memory implementation.
Reference Books Used:
04 1. E Balgurusamy - Programming in ANSI C, Tata McGraw-Hill (Third Edition)
2. YedidyahLangsam, Moshe J Augenstein, Aaron M Tenenbaum – Data structures using C
and C++ - PHI Publications ( 2nd Edition ).
05 Unit related Online Questions:

Sr University
Question Question
No
Explain node structure of Doubly Linked List and explain its SE IT2012
advantages. [4]
DATA STRUCTURE AND ALOGORITHMS

(762)
Define Circular Linked List and compare with respect to SLL. [4]
Write a function in ‘C’ to delete a node in Doubly Linked
List. [6]
Write down advantages of Linked list over arrays. [6]
Write pseudo ‘C’ algorithm to insert a node in Singly Linked
List with all possible conditions. [6]
Explain circular DLL with example. [4]
SE e&tc May-
12
(401)

Write a pseudo ‘C’ code to merge two sorted singly linked


list. What is the complexity ? [5]

Consider the following polynomials represented using linked


lists :
P1 = 5X12+ 2X6 + 3
P2 = 6X12– 5X8+ 12X5
Show the addition process of the above polynomials
diagrammatically. [6]
May-14
What is DLL? Compare with SLL

Write algorithm with appropriate illustrations to perform the following


operations on SLL. Delete a node (start end intermediate)
DATA STRUCTURE AND ALOGORITHMS

Sr. UNIT – V:  Trees University Question Bank


No.
Contents:Difference in linear and non-linear data structure, Basic terminology, Binary
trees, binary search tree representation, BST traversals, Primitive operations on BST: Course
Create, insert, delete. Binary Trees: Create insert and traversals operations.Threaded Binary learnin
01 g
trees: primitive operations, Non-recursive pre-order and in-order traversals. [implementation
Object
not expected]. Concept AVL trees and examples. [implementation not expected]
ives:

Unit Objectives: On completion the students will be able to :


a. Understand the concepts Linear and Non linear DS.
b. Implement non-linear DS Tree.
02 c. Perform Primitive operations on Trees.
d. Understand Types of Tree DS
e. Learn concept of AVL tree.
i.
UNIT Outcomes:
03 1. Student will able to understand real application of Hierarchical behaviour.
2. Create Tree data structure and primitive operations on structure
Reference Books Used:
04 1. E Balgurusamy - Programming in ANSI C, Tata McGraw-Hill (Third Edition)
2. YedidyahLangsam, Moshe J Augenstein, Aaron M Tenenbaum – Data structures using C and C++ - PHI
Publications ( 2nd Edition ).
05 Unit related university Questions:

Sr University
No Question Marks Question
Define the following with examples : [8] SE IT2012
(i) Complete Binary Tree (762)
4
(ii) Predecessor and Successor
(iv) OBST.
What is the necessity of converting a tree into binary
tree ? Convert the following tree into a binary tree and list
6
down the steps for the same. [8]
Or
Write functions for non-recursive pre-order and in-order 6
traversal
algorithms for a in-order threaded binary tree. [8]
DATA STRUCTURE AND ALOGORITHMS

Construct a binary tree from the given traversals : [4]


Pre-order : * + a – b c / – d e – + f g h 6
In-order : a + b – c * d – e / f + g – h
Write a function for creating binary search tree. 6
Write an algorithm for non-recursive in-order traversal of
Binary tree. [8] SE e&tc
May-12
Create an AVL tree for the following elements. Show all (401)
steps
8
with rotation : [6]
1 2 3 4 8 7 6 5.
Write an alogrithm for deleting leaf nodes and nodes with
10
only one child from a Binary Search Tree. [8]
What are threaded trees ? Explain with example. [6] 8
Construct a Binary Search Tree for given numbers, show May-12
all
8
steps : [4]
14, 15, 4, 9, 7, 18, 3, 5, 7.
Write and explain algorithm to insert node into AVL tree.
8
[8]
Explain with example LL, LR, RR, RL rotation for AVL
8
tree. [8]
List and explain in brief applications of binary tree. [4]
What are properties for binary trees that distinguish them
from general tree ? [6]
Write algorithm for traversal of binary tree and give
suitable
example for the same : [8]
(i) Inorder
(ii) Preorder
(iii) Postorder
Write algorithm to delete node from BST. [8]
Write algorithm for inorder traversal of a threaded binary
tree and give its time complexity. Also give example for
the
same. [10]
DATA STRUCTURE AND ALOGORITHMS

Sr. UNIT – VI:  Graph


No.
DATA STRUCTURE AND ALOGORITHMS

Contents:Concepts and terminology, Types of graphs—directed graph, undirected graph, Course


planar graph, representation of graph using adjacency matrix, adjacency list, Traversal, DFS learnin
01 & BFS. Shortest path algorithm: Dijkstra’s algorithm, Minimal spanning tree: Kruskal, g
Prim’s algorithm. Object
ives:

Unit Objectives: On completion the students will be able to :


a. Understand the concept and terminology of Non linear DS-Graph.
02 b. Learn Types of Graphs and representation.
c. Perform Primitive operations on Graphs.
d. Learn different shortest path algorithm.

UNIT Outcomes:
03 3. Student will able to understand real application of Hierarchical behaviour.
4. Create Tree data structure and primitive operations on structure

Reference Books Used:


04 1. E Balgurusamy - Programming in ANSI C, Tata McGraw-Hill (Third Edition)
2. YedidyahLangsam, Moshe J Augenstein, Aaron M Tenenbaum – Data structures using C and C++ - PHI
Publications ( 2nd Edition ).
05 Unit related university Questions:

Sr University
No Question Marks Question
1. Write a function to create GRAPH using adjacency matrix SE IT2012
4
method. (762)
2. For the graph given in Fig. 1, draw minimum cost spanning tree using
Prim’s algorithm, show all steps : [6]

3. What is in-degree, out-degree and degree of a vertex ? Explain with 6


example. [4]
DATA STRUCTURE AND ALOGORITHMS

4. Explain with example inverse adjacency list representation


of graph. [4]
5. What are graph storage structures ? Explain in detail. [8]
(b) Write algorithm for Depth First Traversal of the graph and 6
give suitable example for the same. [8]
6. Write Prim’s algorithm and explain stages of the algorithm
for the following example : [8] SE e&tc
May-12
(401)
7.
Write pseudo code to find the shortest path in weighted graph.
Find the shortest path in the following graph from node 8
0 to node 4. [8]

UNIT IV Question Bank

Sr.
No. Unit IV :Stacks, Queues, Recursion
01 Stacks: Concept, Array representation of stacks, Linked Course
representation of stacks, Stack as ADT, Arithmetic learning
expressions; Polish notation. Application of stacks: Objectives:
Recursion, Implementation of recursive procedures by 1,2,4
stacks.
Queues: Concept, Array representation of queues, Linked
representation of queues, Queue as ADT, Circular queues,
DATA STRUCTURE AND ALOGORITHMS

Dequeues, Priority queues. Application of queues:


Categorizing data, Simulation of
queues.
Unit Objectives: On completion the students will be able to :
a. Learn Restricted data structure Stack.
02 b. Learn the applications of Stack
c. Learn Restricted data structure Queue.
d. Learn the applications of Queue.

UNIT Outcomes:
03 1. Able to create Stack and Queue Data structures for real application
2. Able to understand Real Memory implementation.
Reference Books Used:
1. E Balgurusamy - Programming in ANSI C, Tata McGraw-Hill (Third
04 Edition)
2. YedidyahLangsam, Moshe J Augenstein, Aaron M Tenenbaum – Data
structures using C and C++ - PHI Publications ( 2nd Edition ).
05 Unit related Online Questions: UQP
Q1 Differentiate static and dynamic memory allocation. [4] May2014

Q2 Write pseudo ‘C’ algorithm to insert a node in Singly Linked


List with all possible conditions. [6]
Define GLL with node declaration and represent the following
Q3 polynomial using GLL : [6]
9x2y2 + 6xy2 + 6y2 + y + x2.

Q4 Explain node structure of Doubly Linked List and explain its


advantages. [4]
Q5 Define Circular Linked List and compare with respect to SLL. Dec2013
[4]
Q6 Write a function in ‘C’ to delete a node in Doubly Linked
List. [6]
Q7 Write down advantages of Linked list over arrays. [6]
Q8 Write algorithm to insert an element an element in doubly link May2013
list. Algorithm should include all the cases.
DATA STRUCTURE AND ALOGORITHMS

What is circular linklist ?write application of linked lists.


Q9

Represent following linked list using generalized linked list:


Q10 L={(a,b),c,(d,e,f),g,h}

Signature of Faculty

You might also like