0% found this document useful (0 votes)
58 views

DS Question Bank

The document contains important questions for the Data Structures using C (NCS-301) course at ABES Institute of Technology, covering various units including data structures, algorithms, memory allocation, trees, graphs, and sorting techniques. Each unit features a series of questions that require explanations, algorithms, and programming tasks related to the topics. The questions aim to assess understanding of theoretical concepts and practical programming skills in data structures.

Uploaded by

swati.singhcse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

DS Question Bank

The document contains important questions for the Data Structures using C (NCS-301) course at ABES Institute of Technology, covering various units including data structures, algorithms, memory allocation, trees, graphs, and sorting techniques. Each unit features a series of questions that require explanations, algorithms, and programming tasks related to the topics. The questions aim to assess understanding of theoretical concepts and practical programming skills in data structures.

Uploaded by

swati.singhcse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

ABES INSTITUTE OF TECHNOLOGY, GHAZIABAD

DEPARTMENT OF CSE/IT
UNIT WISE IMPORTANT QUESTIONS
SUBJECT: DATA STRUCTURES USING C (NCS-301) IT SECOND YEAR
UNIT 1
Q.1 What is data structure? Discuss the various implementations of data structures.
Q.2 What do you understand by the term algorithm? Describe the characteristics of an
algorithm.
Q.3 Explain the memory addressing schemes for 2D arrays with suitable examples.
Q.4 Explain sparse matrix. Obtain the indexing formula for lower left triangular matrix using
row major order; consider the case of square matrix of order n×n.
Q.5 Write an algorithm which obtains the transpose of an n×n square matrix.
Q.6 Each element of an array DATA [20][50] requires 4 bytes of storage. Base address of
DATA is 2000. Determine the location of DATA [10][10] when the array is stored as (i)
Row major (ii) Column major.
Q.7 Write a program in C which reverse the order elements in a given string and check
whether the string is palindrome or not.
Q.8 Consider the 3D array X whose subscript limits are:
0 ≤ i ≤ 10, 0 ≤ j ≤ 50, 0 ≤ k ≤ 30.
Assume that storage for the array begins at 2000 in memory and 4 bytes are required to
hold each element of the array. Compute the actual address of the element X [5][20][10]
assuming that array is stored in row major order.
Q.9 Write an interactive program in C which transpose the given matrix.
Q.10Write an algorithm to multiply two matrices and determine complexity of the algorithm.
Q.11Explain merits and demerits of static and dynamic memory allocation techniques.
Q.12What is asymptotic notation? Explain each in brief.
Q.13Discuss the parameters on which efficiency of an algorithm is defined.
Q.14Differentiate between arrays and linked list.
Q.15Write a program to print the information from each node in singly linked list. Make
necessary assumptions.
Q.16Write an algorithm to search an item from a sorted linked list.
Q.17A doubly linked list can be made circular by adjusting appropriate pointers. Suggest the
pointer adjustment.
Q.18Write an algorithm to insert and delete an item into the circular linked list.
Q.19Explain the method to represent the polynomial equation using linked list. Write and
explain method to add two polynomial equations using linked list.
Q.20Write an algorithm to create two way linked lists. Write algorithm to insert and delete
the node from specified location.
Q.21Discuss the implementation of singly linked list. Write C function to implement
following operations on singly linked list
(i) To insert the node at beginning, end and at specified location.
(ii) To count the number of nodes.
(iii)To delete alternate node i.e. first, third and fifth.
UNIT 2

Q.1 Give array implementation of stack. Write functions to implement push and pop
operations on stack.
Q.2 Write an algorithm to convert an infix expression to postfix expression.
Q.3 Write an algorithm to evaluate a postfix expression. Also evaluate the following postfix
expression: 82- 4+567-+*.
Q.4 Consider the following arithmetic expression written in infix notation:
(i) (a+b) /d ^ (e- f)+g)
(ii)(A+B)*C +D/(B+A*C)+D
Convert the above expression into postfix and presfix expression.
Q.5 Give the data structure to implement two stacks in same array.Write functions to
implement Push operation on both the stacks.
Q.6 Answer the following questions:
(i) Write down the applications of stack.
(ii) Write a program in C to show PUSH and POP operations in a Stack.
Q.7 Write an algorithm to convert a postfix expression to infix expression.
Q.8 What is a tail recursion? Discuss with an example.
Q.9 Explain the Tower of Hanoi problem and write a recursive algorithm to solve it.
Q.10 The following pseudo-code computes the kth power of x
Power (x,k)
If k=0 then return 1
Else if k is even then
Return sqr (power(x,k/2))
Else
Return x* sqr (power(x, k/2))
Write down the running time recurrence.
Q.11 What is recursion? Explain.
Q.12 What is priority queue? How can you represent a priority queue in memory? Explain.
Q.13 What is circular queue?
Q.14 With a suitable example demonstrate CREATE, ADD, DELETE, EMPTY and FULL
FUNCTIONS on a queue data structure.
Q.15 Write an algorithm that reverse all the elements in a queue.
Q.16 Write C functions to add and delete elements from either end of dqueue.
UNIT 3
Q.1 What is binary tree data structure? How it is represented in computer memory?
Q.2 Define the following(i) Tree (ii) Vertex of a tree (iii) Forest (iv) Depth or height
(v) Strictly binary tree (vi) Complete binary tree (vii) Full binary tree.
Q.3 Prove that for any non empty binary tree, if n0 is number of leaf nodes and n2 is the
number of nodes with degree 2 then n0= n2+1.
Q.4 Discuss the threaded binary trees. Explain its memory representation with suitable
example.
Q.5 Describe Huffman algorithm.Draw a Huffman tree and codes for the following symbols
whose frequency of occurrence in a message is stated along with the symbol below :
A : 15, B : 6, C : 7, D : 12, E : 25, F : 4, G : 6, H : 1, I : 15;
Also Decode the message : 1110100010111011.
Q.6 What are the different traversing techniques used in tree? Explain each giving suitable
example.
Q.7 Determine the height of a complete binary tree with n number of nodes.
Q.8 If I and E are the internal and external path lengths, respectively, of a binary tree with n
nodes then determine the relationship between I and E.
Q.9 Consider the binary tree given below :

Traverse the given tree using preorder, inorder and postorder traversals.
Q.10 Find the original trees from the following given traversals :
(i) Inorder : EACKFHDBG
Preorder FAEKCDHGB
(ii) Preorder : GBQACKFPDERH
Inorder : QBKCFAGPEDHR
(iii) Inorder : MEPAQTRCFK
Postorder : MPEQRCTKFA.
(iv) Preorder : 14, 4, 3, 9, 7, 5, 10, 15, 18, 16, 17, 20
Postorder :3, 5, 7, 10, 9, 4, 17, 16, 20, 18, 15, 14.
Q.11 Write algorithms or function to obtain traversals of a binary tree in preorder, postorder
and inorder.
Q.12 Show that the maximum number of nodes in a binary tree of height h is 2 h+1-1. Also show
that minimum height of a binary tree with n nodes is [log2 (n+1) – 1].
Q.13 Prove that in a binary tree the number of leaves = the number of nodes with two children
+ 1.
Q.14 Write a C function to count the number of leaf nodes in a binary tree.
Q.15 Define binary tree. Explain the linear sequential representation of binary tree. Write the
advantages and disadvantages of sequential presentation of binary trees.
UNIT 4
Q.1 What is graph data structure? Why it is called non-linear? Discuss about its applications.
Q.2 Draw one example for each of the following :
(i) Connected multigraph (ii) Loop-free multigraph.
Q.3 Write algorithm for Bredth-First and Depth-First search traversals of a graph with
examples.
Q.4 What is spanning tree? Draw the minimum cost spanning tree for the graph given below
and also find its cost.

Q.5 Give Kruskal’s algorithm, find a minimum cost spanning tree, of the following graph.

Q.6 Describe Dijkastra’s algorithm for finding shortest path. Apply Dijkastra’s algorithm to
find shortest path between node A and D.

Q.7 Consider the following graph :

Perform a Bredth-first beginning at vertex V1. List the vertices visited.


Q.8 For the given graph :

(i) Find its adjacency matrix.

(ii) Find its matrix using adjacency matrix.

Q.9 For a undirected graph G with n vertices and e edges, show that :

Di = 2e ; where di = degree of vertex i.

Q.10 Find the minimum spanning tree using Prim’s algorithm for the given graph :

Q.11 Define connected component in a graph and write pseudo code to find the connected
components of a graph with example.

Q.12 How a graph can be represented to store in memory? Show with examples.

Q.13 What is path matrix? How path matrix can be determined? Explain the method.

Q.14 Write and explain an algorithm for finding shortest path between any two nodes of a
given graph.

Q.15 Describe Kruskal and Prim’s algorithm to find the minimum cost spanning tree and
explain the complexity. Determine the minimum cost spanning tree for the graph given below
:

Q.16 Write and explain Dijkstra’s algorithm for finding shortest path.
UNIT 5

Q.1 Write a C function to insert elements in a BST.


Q.2 Construct a height balanced Binary search tree by performing following operations:
Step I: Insert 19, 16, 21, 11, 17, 25, 6, 13
Step 2: lnsert 5
Step 3: Delete 16
Q.3 How a node can be deleted from the binary search tree? Explain the methods.
Q.4 What is an AVL tree? Show at each steps the AVL tree build from the following
sequence of insertions: 8, 15, 1, 19, 16, 4, 25, 12, 23, 20, 17. Start with empty
tree Label the rotations according to type.
Q.5 Define AVL tree. Take an example to show INSERTION and DELETION in an AVL
tree.
Q.6 Write the algorithm for merge sort. Explain its complexities. Sort the following with
merge sort: 75,10,20,70,80,90,100,40,30,50.
Q.7 Discuss the quick sort algorithm. Justify, how the selection of pivots element play a
major role in efficiency of the quick sort algorithm and give the best case analysis
of quick sort.
Q.8 Write a program in C for binay search. Analyze its running time and also compare with
linear seach.
Q.9 Show the trace of the heap sort algorithm for the following data: 22, 55, 6, 7, 3, 66, 89,
56, 49, 65, 34, 67.
Q.10 Write the properties of B-tree. Construct a B-tree on the following sequence of inputs :
10, 20, 30, 40, 50, 60, 70, 80, 90. Assume that the order of the B-tree is 3.
Q.11 What is B-tree? Describe the method to delete an item from B-tree.
Q.12 What do you mean by hashing? Name two hashing techniques and explain any one.
Q.13 Write the conditions when collision occurs in hashing. Describe any collision detection
algorithm in brief.
Q.14 What are the disadvantages of linear probing in hashing?
Q.15 Write short note on the following :
(i) Garbage collection and compaction (ii) B+ tree.

You might also like