S J C Institute of Technology Dept. of Computer Science & Engineering SUB: Data Structures & Applications (18CS32) Class: Tutorial 3
S J C Institute of Technology Dept. of Computer Science & Engineering SUB: Data Structures & Applications (18CS32) Class: Tutorial 3
S J C Institute of Technology
Dept. of Computer Science & Engineering
SUB: Data Structures & Applications (18CS32) Class: 3 Semester ‘A’ & ‘B’ section
TUTORIAL 3
MODULE 4
1) What is a tree? Write the routines to traverse the given string using
i. Pre-order traversal
ii. In-order traversal
iii. Post-order traversal
2) Define binary search tree. Write the recursive search and iterative search algorithms for a
binary search tree.
3) Write the routines for:
i. Copying binary trees
ii. Testing for equality of binary trees
4) List the rules to construct the threads. Write the routines for in-order traversal of a threaded
binary tree.
5) Define the following (with examples) – 2m each
i. Binary tree
ii. Complete binary tree
iii. Binary search tree
iv. Threaded binary tree
v. Skewed binary tree
6) Explain binary tree using Array representation and linked representation. Which
representation is more suitable and why?
7) Give in-order sequence: DJGBHEAFKIC and post-order sequence: JGDHEBKIFCA.
Construct BT for the same.
8) Write a function to insert an ordered binary search tree (duplicate items are not allowed).
9) Represent the tree given in fig. using:
i. List representation
ii. Left-child Right sibling representation
iii. Degree 2 (or binary tree) representation
10) (a) Construct a binary tree for given expression: ((6+ (3-2)*5) ^2+3).
(b) Construct BST for the element step-by-step:
100, 85, 45, 55, 110, 20, 70, 65, 113, 145, 132, and 96.
(Module 5 - PTO)
1
MODULE 5
11) Write an algorithm for insertion sort. Also discuss about the complexity of the insertion sort.
12) Define the following:
i. Graph
ii. Multi-graph
iii. Graph with self-edge
iv. Sub-graph
v. Complete graph.
13) Consider the following 4 digit employee number 9614, 5882, 6713, 4409, and 1825. Find 2
digit hash address of each number using
1) Division method with 97
2) Mid-square method.
3) The folding method without reversing
4) The folding method with reversing
14) What are the methods used for traversing a graph. Explain any one with example and write
function for same.
15) Explain in detail about static and dynamic hashing.
16) Define graph and explain in detail about the directed graph.
17) How an insertion sort works? Suppose an array A contains 8 elements as follows:
77, 33, 44, 11, 88, 22, 66, 55. Trace insertion sort algorithm for sorting in ascending order.
18) What is graph? Give matrix and adjacency list representation of graph. Show adjacency
matrix and list for the below graph
19) Explain hashing and collision. Explain the methods to resolve the collision.
20) Write algorithm for BFS and DFS graph traversal methods.