University Questions

You might also like

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

University Questions

UNIT - 1

1. Explain briefly about abstract data types.[2 times]

2. Pattern matching.[1 time]

3. Explain briefly about string representation and manipulation.[3 times]

4. How will you perform space and time analysis of an algorithm. Explain with example.[3
times]

5. Explain quick sort with example. [3 times]

6. Explain any 3 sorting techniques. [1 time]

7. Bubble sort.[1 time]

8. Insertion sort.[1 time]

9. Heap sort.[2 times]

10. Explain about the two searching techniques. [2 times]

UNIT – 2

1. Explain how an array can be used for storing a sparse matrix. Discuss the advantages of
sparse matrix.[5 times repeated]

2. Write short notes on priority queues.[4 times repeated]

3. Discuss the application of a stack.[4 times repeated]

4. What is circular queue? Explain the operations with algorithms.[3 times repeated]

5. Discuss the Garbage collection & Compaction.[3 times repeated]

6. Explain the operations performed on Stack and Queue with algorithms.[3 times repeated]

7. Explain the operations performed in single and double linked list with examples and
algorithms.[2 times repeated]

8. Explain the circular linked list in detail. [2 times repeated].

M.Suganthy A.P/CSE Dr.SJSPMCET Page 1


University Questions

UNIT – 3

1. What is Spanning tree? Explain in detail.[5 times]

2. Explain the Tree traversal algorithms.[3 times]

3. Describe the Topological sort with example.[2 times]

4. What is Graph? Explain the terminologies, representation and shortest path algorithm. [3
times]

5. What are non-linear data structures?

6. Give the terminologies, representation, traversal and applications of a Tree.[2 times]

7. Explain DFS and BFS. [ 1 Time]

8. Binary Trees [1 Time]

UNIT – 4

1. Explain about hash tables. What are the different properties of a hash function give
suitable examples. [6 times]

2. Explain in detail about static and dynamic tree table. [2 times]

3. Explain in detail about static and dynamic symbol tables.[2 times]

4. Discuss collision resolution in hash tables.[2 times]

5. What are symbol tables? Explain the structure of symbol table.[6 times]

6. What are the constraints to be considered in the design of symbol table? Explain them.
Develop an algorithm to construct a symbol table. [ 1 time]

7. What is Symbol table and what are its types. Explain. [ 1 time]

UNIT – 5

1. Discuss any 2 index techniques[2 times]


2. Explain
a. File organization [3 times].
b. ISAM [3 times].
3. Virtual hashing [5 times].

M.Suganthy A.P/CSE Dr.SJSPMCET Page 2


University Questions

4. Linear hashing[3 times]


5. VSAM files[6 times]
6. Multiple key access[3 times]
7. External searching[1 time]
8. External storage devices[2 times]
9. Virtual memory[2 times]
10. Explain various file structure.
11. Indexed sequential files [2 times]
12. Direct files and their properties[3 times]
13. Compare sequential, indexed sequential and direct files[3 times]
14. Explain Sequential file organization[2 times]
15. Show that
a. Any external sorting algorithm that uses one take as external storage must take (n2)
time to sort n records.

b. 0(n logn) time suffixes if there are two takes to use as external storage.

M.Suganthy A.P/CSE Dr.SJSPMCET Page 3


University Questions

1.What is data structure?


A data structure is a way of organizing data that considers not only the items
stored, but also their relationship to each other. Advance knowledge about the
relationship between data items allows designing of efficient algorithms for the
manipulation of data.

2. List out the areas in which data structures are applied extensively?
Ø Compiler Design,
Ø Operating System,
Ø Database Management System,
Ø Statistical analysis package,
Ø Numerical Analysis,
Ø Graphics,
Ø Artificial Intelligence,
Ø Simulation

3. What are the major data structures used in the following areas : RDBMS, Network
data model & Hierarchical data model.
Ø RDBMS – Array (i.e. Array of structures)
Ø Network data model – Graph
Ø Hierarchical data model – Trees

4. If you are using C language to implement the heterogeneous linked list, what pointer
type will you use?
The heterogeneous linked list contains different data types in its nodes and we
need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So
we go for void pointer. Void pointer is capable of storing pointer to any type as it is a
generic pointer type.

5. Minimum number of queues needed to implement the priority queue?


Two. One queue is used for actual storing of data and another for storing
priorities.

6. What is the data structures used to perform recursion?


Stack. Because of its LIFO (Last In First Out) property it remembers its ‘caller’ so
knows whom to return when the function has to return. Recursion makes use of system
stack for storing the return addresses of the function calls.
Every recursive function has its equivalent iterative (non-recursive) function.
Even when such equivalent iterative procedures are written, explicit stack is to be used.

M.Suganthy A.P/CSE Dr.SJSPMCET Page 4


University Questions

7. What are the notations used in Evaluation of Arithmetic Expressions using prefix and
postfix forms?
Polish and Reverse Polish notations.

8. Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent Prefix and


Postfix notations.
Prefix Notation:
^ - * +ABC - DE + FG
Postfix Notation:
AB + C * DE - - FG + ^

9. Sorting is not possible by using which of the following methods?


(a) Insertion
(b) Selection
(c) Exchange
(d) Deletion
(d) Deletion.
Using insertion we can perform insertion sort, using selection we can perform
selection sort, using exchange we can perform the bubble sort (and other similar sorting
methods). But no sorting method can be done just using deletion.

10. A binary tree with 20 nodes has null branches?


21
Let us take a tree with 5 nodes (n=5)
It will have only 6 (ie,5+1) null branches. In general,
A binary tree with n nodes has exactly n+1 null nodes.

11. What are the methods available in storing sequential files ?


Ø Straight merging,
Ø Natural merging,
Ø Polyphase sort,
Ø Distribution of Initial runs.

12. How many different trees are possible with 10 nodes ?


1014
For example, consider a tree with 3 nodes(n=3), it will have the maximum
combination of 5 different (ie, 23 - 3 = 5) trees.
Null Branches
i ii iii iv v
In general:

M.Suganthy A.P/CSE Dr.SJSPMCET Page 5


University Questions

If there are n nodes, there exist 2n-n different trees.

13. List out few of the Application of tree data-structure?


Ø The manipulation of Arithmetic expression,
Ø Symbol Table construction,
Ø Syntax analysis.

14. List out few of the applications that make use of Multilinked Structures?
Ø Sparse matrix,
Ø Index generation.

15. In tree construction which is the suitable efficient data structure?


(a) Array (b) Linked list (c) Stack (d) Queue (e) none
(b) Linked list

16. What is the type of the algorithm used in solving the 8 Queens problem?
Backtracking
17. In an AVL tree, at what condition the balancing is to be done?
If the ‘pivotal value’ (or the ‘Height factor’) is greater than 1 or less than –1.

18. What is the bucket size, when the overlapping and collision occur at same time?
One. If there is only one entry possible in the bucket, when the collision occurs,
there is no way to accommodate the colliding value. This results in the overlapping of
values.

19. Traverse the given tree using Inorder, Preorder and Postorder traversals.
A
BC
DEFG
Given tree:
Ø Inorder : D H B E A F C I G J
Ø Preorder: A B D H E C F G I J
Ø Postorder: H D E B F I J G C A

20. There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could
have formed a full binary tree?
15.
In general:
There are 2n-1 nodes in a full binary tree.
By the method of elimination:

M.Suganthy A.P/CSE Dr.SJSPMCET Page 6


University Questions

Full binary trees contain odd number of nodes. So there cannot be full
binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete
binary tree but not a full binary tree. So the correct answer is 15.
Note:
Full and Complete binary trees are different. All full binary trees are complete
binary trees but not vice versa.

21. In the given binary tree, using array you can store the node 4 at which location?
At location 6
123--4--5
1
23
4
5
Root LC1 RC1 LC2 RC2 LC3 RC3 LC4 RC4
where LCn means Left Child of node n and RCn means Right Child of node n

22. Sort the given values using Quick Sort?


65 70 75 80 85 60 55 50 45
Sorting takes place from the pivot value, which is the first value of the given
elements, this is marked bold. The values at the left pointer and right pointer are indicated
using L and R respectively.
65 70L 75 80 85 60 55 50 45R
Since pivot is not yet changed the same process is continued after interchanging the
values at L and R positions
65 45 75 L 80 85 60 55 50 R 70
65 45 50 80 L 85 60 55 R 75 70
65 45 50 55 85 L 60 R 80 75 70
65 45 50 55 60 R 85 L 80 75 70
When the L and R pointers cross each other the pivot value is interchanged with the value
at right pointer. If the pivot is changed it means that the pivot has occupied its original
position in the sorted order (shown in bold italics) and hence two different arrays are
formed, one from start of the original array to the pivot position-1 and the other from
pivot position+1 to end.
60 L 45 50 55 R 65 85 L 80 75 70 R
55 L 45 50 R 60 65 70 R 80 L 75 85
50 L 45 R 55 60 65 70 80 L 75 R 85
In the next pass we get the sorted form of the array.
45 50 55 60 65 70 75 80 85

M.Suganthy A.P/CSE Dr.SJSPMCET Page 7


University Questions

23. For the given graph, draw the DFS and BFS?
Ø BFS: A X G H P E M Y J
Ø DFS: A X H P E Y M J G
24. Classify the Hashing Functions based on the various methods by which the key value
is found.
Ø Direct method,
Ø Subtraction method,
Ø Modulo-Division method,
Ø Digit-Extraction method,
Ø Mid-Square method,
Ø Folding method,
Ø Pseudo-random method.

25. What are the types of Collision Resolution Techniques and the methods used in each
of the type?
Ø Open addressing (closed hashing),
The methods used include:
Overflow block,
Ø Closed addressing (open hashing)
The methods used include:
Linked list,
Binary tree…

26. In RDBMS, what is the efficient data structure used in the internal storage
representation?
B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes
searching easier. This corresponds to the records that shall be stored in leaf nodes.
27. Draw the B-tree of order 3 created by inserting the following data arriving in
sequence – 92 24 6 7 11 8 22 4 5 16 19 20 78
The given graph:
11 -
5 7 19 24

28.Of the following tree structure, which is, efficient considering space and
time complexities?
(a) Incomplete Binary Tree
(b) Complete Binary Tree
(c) Full Binary Tree
(b) Complete Binary Tree.
By the method of elimination:

M.Suganthy A.P/CSE Dr.SJSPMCET Page 8


University Questions

Full binary tree loses its nature when operations of insertions and deletions
are done. For incomplete binary trees, extra storage is required and overhead of NULL
node checking takes place. So complete binary tree is the better one since the property of
complete binary tree is maintained even after operations like additions and deletions are
done on it.

29. What is a spanning Tree?


A spanning tree is a tree associated with a network. All the nodes of the graph
appear on the tree once. A minimum spanning tree is a spanning tree organized so that
the total edge weight between nodes is minimized.
30. Does the minimum spanning tree of a graph give the shortest distance between any 2
specified nodes?
No.
Minimal spanning tree assures that the total weight of the tree is kept at its
minimum. But it doesn’t mean that the distance between any two nodes involved in the
minimum-spanning tree is minimum.
31. Convert the given graph with weighted edges to minimal spanning tree.
13
24
410 5
600
200
400
310
1421
2985
612
the equivalent minimal spanning tree is:

32. Which is the simplest file structure?


(a) Sequential
(b) Indexed
(c) Random
(a) Sequential

33. Whether Linked List is linear or Non-linear data structure?


According to Access strategies Linked list is a linear one.
According to Storage Linked List is a Non-linear one.
34. Draw a binary Tree for the expression :
A * B - (C + D) * (P / Q)

M.Suganthy A.P/CSE Dr.SJSPMCET Page 9


University Questions

35. For the following COBOL code, draw the Binary tree?
01 STUDENT_REC.
-
**
AB+/
CDPQ
1
2
3
45
410 612
200
310
02 NAME.
03 FIRST_NAME PIC X(10).
03 LAST_NAME PIC X(10).
02 YEAR_OF_STUDY.
03 FIRST_SEM PIC XX.
03 SECOND_SEM PIC XX.
STUDENT_REC
NAME YEAR_OF_STUDY
FIRST_NAME LAST_NAME FIRST_SEM SECOND_

M.Suganthy A.P/CSE Dr.SJSPMCET Page 10


University Questions

UNIT - 1
1.Write down the definition of data structures?
A data structure is a mathematical or logical way of organizing data in the memory that consider
not only the items stored but also the relationship to each other and also it is characterized by
accessing functions.
2.What is meant by problem solving?
Problem solving is a creative process, which needs systemization and mechanization.
3. Give few examples for data structures?
Stacks, Queue, Linked list, Trees, graphs
4. What is problem definition phase?
The first step in solving a problem is to understand problem clearly. Hence, the first phase is the
problem definition phase. That is, to extract the task from the problem statement. If the problem
is not understood, then the solution will not be correct and it may result in wastage of time and
effort.
5. Define Algorithm?
Algorithm is a solution to a problem independent of programming language. It consist of set of
finite steps which, when carried out for a given set of inputs, produce the corresponding output
and terminate in a finite time.
6. Define Program?
Set of instructions to find the solution to a problem. It is expressed in a programming language in
an explicit and unambiguous manner.
7. Mention how similarities among the problems are used in problem solving?
This method is used to find out if a problem of this sort has been already solved and to adopt a
similar method in solving the problem. The contribution of experience in the previous problem
with help and enhance the method of problem for the current problem.
8. What is working backward from the solution?
When we have a solution to the problem then we have to work backward to find the starting
condition. Even a guess can take us to the starting of the problem. This is very important to
sytematize the investigation to avoid duplication of our effort.
9. Mention some of the problem solving strategies?
The most widely strategies are listed below

M.Suganthy A.P/CSE Dr.SJSPMCET Page 11


University Questions

 Divide and conquer


 Binary doubling strategy
 Dynamic programming
10. What is divide and conquer method?
The basic idea is to divide the problem into several sub problems beyond which cannot be further
subdivided. Then solve the sub problems efficiently and join then together to get the solution for
the main problem.
11. What are the features of an efficient algorithm?
 Free of ambiguity
 Efficient in execution time
 Concise and compact
 Completeness
 Definiteness
 Finiteness
12. List down any four applications of data structures?
 Compiler design
 Operating System
 Database Management system
 Network analysis
13. What is binary doubling strategy?
The reverse of binary doubling strategy, i.e. combining small problems in to one is known as
binary doubling strategy. This strategy is used to avoid the generation of intermediate results.
14. Where is dynamic programming used?
Dynamic programming is used when the problem is to be solved in a sequence of intermediate
steps. It is particularly relevant for many optimization problems, i.e. frequently encountered in
Operations research.
15. Define top-down design?
Top-down design is a strategy that can be applied to find a solution to a problem from a vague
outline to precisely define the algorithm and program implementation by stepwise refinement.
16. Mention the types of bugs that may arise in a program?

M.Suganthy A.P/CSE Dr.SJSPMCET Page 12


University Questions

The different types of bugs that can arise in a program are


 Syntactic error
 Semantic error
 Logical error
17. What is program testing?
Program testing is process to ensure that a program solves the smallest possible problem, when
all the variables have the same value, the biggest possible problem, unusual cases etc.
18. What is program verification?
Program verification refers to the application of mathematical proof techniques, to verify that the
results obtained by the execution of the program with arbitrary inputs are in accord with formally
defined output Specifications.
19. How will you verify branches with segments?
To handle the branches that appear in the program segments, it is necessary to set-up and proves
verification conditions individually.
20.What is proof of termination?
To prove that a program accomplishes its stated objective in a finite number of steps is called
program termini nation. The prooft of termination is obtained directly from the properties of the
interactive constructs.

PART-B
1.Explain top-down design in detail?
• Definition
• Breaking a problem in to subproblems
• Choice of a suitable data structure
• Constructions of loops
• Establishing initial conditions for loops
• Finding the iterative construct
• Terminations of loops
2. What are the steps taken to improve the efficiency of an algorithm?
• Definition
• Redundant computations

M.Suganthy A.P/CSE Dr.SJSPMCET Page 13


University Questions

• Referencing array elements


• Inefficiency due to late termination
• Early detection of desired output conditions
• Trading storage for efficiency gains
3. Design an algorithm fro sine function computation. Explain it with an example?
• Algorithm development
• Algorithm description
• Pascal implementation
• Application
4. Design an algorithm for reversing the digit of an integer. Explain it with an
example?
• Algorithm development
• Algorithm description
• Pascal implementation
• Application
5. Design an algorithm for base conversion. Explain it with an example?
• Algorithm development
• Algorithm description
• Pascal implementation
• Application

UNIT –II

PART-A
1.What is meant by an abstract data type?
An ADT is a set of operation. Abstract data types are mathematical abstractions.Eg.Objects such
as list, set and graph along their operations can be viewed as ADT's.
2. What are the operations of ADT?
Union, Intersection, size, complement and find are the various operations of ADT.
3. What is meant by list ADT?

M.Suganthy A.P/CSE Dr.SJSPMCET Page 14


University Questions

List ADT is a sequential storage structure. General list of the form a1, a2, a3.…., an and the size
of the list is 'n'. Any element in the list at the position I is defined to be ai, ai+1 the successor of
ai and ai-1 is the predecessor of ai.
4. What are the various operations done under list ADT?
• Print list
• Insert
• Make empty
• Remove
• Next
• Previous
• Find kth
5. What are the different ways to implement list?
• Simple array implementation of list
• Linked list implementation of list
6. What are the advantages in the array implementation of list?
a) Print list operation can be carried out at the linear time
b) Fint Kth operation takes a constant time
7. What is a linked list?
Linked list is a kind of series of data structures, which are not necessarily adjacent in memory.
Each structure contain the element and a pointer to a record containing its successor.
8. What is a pointer?
Pointer is a variable, which stores the address of the next element in the list. Pointer is basically a
number.
9. What is a doubly linked list?
In a simple linked list, there will be one pointer named as 'NEXT POINTER' to point the next
element, where as in a doubly linked list, there will be two pointers one to point the next element
and the other to point the previous element location.
10. Define double circularly linked list?
In a doubly linked list, if the last node or pointer of the list, point to the first element of the list,
then it is a circularly linked list.

M.Suganthy A.P/CSE Dr.SJSPMCET Page 15


University Questions

11. What is the need for the header?


Header of the linked list is the first element in the list and it stores the number of elements in the
list. It points to the first data element of the list.
12. List three examples that uses linked list?
• Polynomial ADT
• Radix sort
• Multi lists
13. Give some examples for linear data structures?
• Stack
• Queue
14. What is a stack?
Stack is a data structure in which both insertion and deletion occur at one end only. Stack is
maintained with a single pointer to the top of the list of elements. The other name of stack is
Last-in -First-out list.
15. Write postfix from of the expression –A+B-C+D?
A-B+C-D+
16. How do you test for an empty queue?
To test for an empty queue, we have to check whether READ=HEAD where REAR is a pointer
pointing to the last node in a queue and HEAD is a pointer that pointer to the dummy header. In
the case of array implementation of queue, the condition to be checked for an empty queue is
READ<FRONT.
17.What are the postfix and prefix forms of the expression?
A+B*(C-D)/(P-R)
Postfix form: ABCD-*PR-/+
Prefix form: +A/*B-CD-PR
18. Explain the usage of stack in recursive algorithm implementation?
In recursive algorithms, stack data structures is used to store the return address when a recursive
call is Encountered and also to store the values of all the parameters essential to the
current state of the procedure.
19. Write down the operations that can be done with queue data structure?

M.Suganthy A.P/CSE Dr.SJSPMCET Page 16


University Questions

Queue is a first - in -first out list. The operations that can be done with queue are addition and
deletion.
20. What is a circular queue?
The queue, which wraps around upon reaching the end of the array is called as circular queue.

PART-B

1.Explain the linked list implementation of list ADT in Detail?


_ Definition for linked list
_ Figure for linked list
_ Next pointer
_ Header or dummy node
_ Various operations
• Explanation
• Example figure
• Coding
2. Explain the cursor implementation of linked list?
_ Definition for linked list
_ Figure for linked list
_ Next pointer
_ Header or dummy node
_ Various operations
• Explanation
• Example figure
• Coding
3. Explain the various applications of linked list?
_ Polynomical ADT
• Operations
• Coding
• Figure
_ Radix Sort

M.Suganthy A.P/CSE Dr.SJSPMCET Page 17


University Questions

• Explanation
• Example
_ Multilist
• Explanation
• Example figure
4. Explain the linked list implementation of stack ADT in detail?
_ Definition for stack
_ Stack model
_ Figure
_ Pointer-Top
_ Operations
• Coding
• Example figure
5. Explain the array implementation of queue ADT in detail?
_ Definition for stack
_ Stack model
_ Figure
_ Pointer-FRONT, REAR
_ Operations
• Coding
• Example figure

UNIT-III

PART-A
1. Define non-linear data structure
Data structure which is capable of expressing more complex relationship than that of physical
adjacency is called non-linear data structure.
2. Define tree?
A tree is a data structure, which represents hierarchical relationship between individual data
items.

M.Suganthy A.P/CSE Dr.SJSPMCET Page 18


University Questions

3. Define leaf?
In a directed tree any node which has out degree o is called a terminal node or a leaf.
4. What is meant by directed tree?
Directed tree is an acyclic diagraph which has one node called its root with indegree o whille all
other nodes have indegree I.
5. What is a ordered tree?
In a directed tree if the ordering of the nodes at each level is prescribed then such a tree is called
ordered tree.
6. What are the applications of binary tree?
Binary tree is used in data processing.
a. File index schemes
b. Hierarchical database management system
7. What is meant by traversing?
Traversing a tree means processing it in such a way, that each node is visited only once.
8. What are the different types of traversing?
The different types of traversing are
a. Pre-order traversal-yields prefix from of expression.
b. In-order traversal-yields infix form of expression.
c. Post-order traversal-yields postfix from of expression.
9. What are the two methods of binary tree implementation?
Two methods to implement a binary tree are,
a. Linear representation.
b. Linked representation
10. Define pre-order traversal?
Pre-order traversal entails the following steps;
a. Process the root node
b. Process the left subtree
c. Process the right subtree
11.Define post-order traversal?
Post order traversal entails the following steps;
a. Process the left subtree

M.Suganthy A.P/CSE Dr.SJSPMCET Page 19


University Questions

b. Process the right subtree


c. Process the root node
12. Define in -order traversal?
In-order traversal entails the following steps;
a. Process the left subtree
b. Process the root node
c. Process the right subtree
13. What is a balance factor in AVL trees?
Balance factor of a node is defined to be the difference between the height of the node's left
subtree and the height of the node's right subtree.
14. What is meant by pivot node?
The node to be inserted travel down the appropriate branch track along the
way of the deepest level node on the branch that has a balance factor of +1 or -1 is
called pivot node.
15. What is the length of the path in a tree?
The length of the path is the number of edges on the path. In a tree there is
exactly one path form the root to each node.
16. Define expression trees?
The leaves of an expression tree are operands such as constants or variable
names and the other nodes contain operators.
17. What is the need for hashing?
Hashing is used to perform insertions, deletions and find in constant
average time.
18. Define hash function?
Hash function takes an identifier and computes the address of that identifier
in the hash table using some function.
19. List out the different types of hashing functions?
The different types of hashing functions are,
a. The division method
b. The mind square method
c. The folding method

M.Suganthy A.P/CSE Dr.SJSPMCET Page 20


University Questions

d. Multiplicative hashing
e. Digit analysic
20. What are the problems in hashing?
a. Collision
b. Overflow
21. What are the problems in hashing?
When two keys compute in to the same location or address in the hash table
through any of the hashing function then it is termed collision.

PART-B
1. Explain the different tree traversals with an application?
_ In order
• Explanation with an example
• Figure
_ Preorder
• Explanation with an example
• Figure
_ Postorder
• Explanation with an example
• Figure
2. Define binary search tree? Explain the various operations with an example?
_ Definition
_ Figure for binary search tree
_ Operations
• Codings
• Explanation
• Example
3. Define AVL trees? Explain the LL, RR, RL, LR case with an example?
_ Definition
_ LL, RR, RL, LR case
• Figure

M.Suganthy A.P/CSE Dr.SJSPMCET Page 21


University Questions

• Example
• Explanation
4. Define priority queue? Explain the basic heap operation with an example?
_ Definition
_ Basic operation
• Insert
• Delmin
• Delmax
_ Coding
_ Explanation
_ Example
5. Explain any two techniques to overcome hash collision?
_ Separate chaining
• Example
• Explanation
• Coding
_ Open addressing
• Linear probing
• Quadratic probing

UNIT-IV
PART-A
1.What is meant by sorting?
Ordering the data in an increasing or decreasing fashion according to some relationship among
the data item is called sorting.
2. What are the two main classifications of sorting based on the source of data?
a. Internal sorting
b. External sorting
3. What is meant by external sorting?
External sorting is a process of sorting in which large blocks of data stored in storage devices are
moved to the main memory and then sorted.

M.Suganthy A.P/CSE Dr.SJSPMCET Page 22


University Questions

4. What is meant by internal sorting?


Internal sorting is a process of sorting the data in the main memory.
5. What are the various factors to be considered in deciding a sorting algorithm?
a. Programming time
b. Execution time of the program
c. Memory needed for program environment
6. What is the main idea behind insertion sort?
The main idea of insertion sort is to insert in the ith pass the ith element in
A (1) A (2)...A (i) in its rightful place.
7. What is the main idea behind insertion sort?
The main idea behind the selection sort is to find the smallest element among in A (I) A (J+1)...A
(n) and then interchange it with a (J). This process is then repeated for each value of J.
8. What is the basic of shell sort?
Instead of sorting the entire array at once, it is first divide the array into smaller segments, which
are then separately sorted using the insertion sort.
9. What is the other name for shell sort?
Diminishing increment sort.
10. What is the purpose of quick sort?
The purpose of the quick sort is to move a data item in the correct direction, just enough for to
reach its final place in the array.
11. What i the advantage of quick sort?
Quick sort reduces unnecessary swaps and moves an item to a greater distance, in one move.
12. What is the average efficiency of heap sort?
The average efficiency of heap sort is 0 (n(log2 n)) where, n is the number of elements sorted.
13. Define segment?
When large blocks of data are to be sorted, only a portion of the block or file is loaded in the
main memory of the computer since, it cannot hold the entire block. This small portion of file is
called a segment.
14. Name some of the external sorting methods?
a. Polyphase merging
b. Oscillation sorting

M.Suganthy A.P/CSE Dr.SJSPMCET Page 23


University Questions

c. Merge sorting
15. When is a sorting method said to be stable?
A sorting method is said to be stable, it two data items of matching values are guaranteed to be
not rearranged with respect to each other as the algorithm progresses.
16. Name some simple algorithms used in external sorting?
a. Multiway merge
b. Polyphase merge
c. Replacement selection
17. When can we use insertion sort?
Insertion sort is useful only for small files or very nearly sorted files.
18. How many passes are required fork-way merging?
The number of passes required using k-way merging is [log k (n/m)] because the N H S get k
times as large in each pass.
19. Define max heap?
A heap in which the parent has a larger key than the child's is called a max
heap.
20. Define min heap?
A heap in which the parent has a smaller key than the child's is called a min heap.
PART-B
1.Explain heap sort with an example?
• Explanation
• Example
• Figure
• Coding
2. Explain quick sort with an example?
• Explanation
• Example
• Figure
• Coding
3. Explain quick sort with an example?
• Explanation

M.Suganthy A.P/CSE Dr.SJSPMCET Page 24


University Questions

• Example
• Figure
• Coding
4. Explain any four external sorting techniques with example?
• Explanation
• Example
• Figure
• Coding
5. Explain shell sort with an example?
• Explanation
• Example
• Figure
• Coding
PART-B
1.Explain heap sort with an example?
_ Explanation
_ Example
_ Figure
_ Coding
2. Explain quick sort with an example?
_ Explanation
_ Example
_ Figure
_ Coding
3. Explain merge sort with an example?
_ Explanation
_ Example
_ Figure
_ Coding
4. Explain any four external sorting techniques with example?
_ Explanation

M.Suganthy A.P/CSE Dr.SJSPMCET Page 25


University Questions

_ Example
_ Figure
_ Coding
5. Explain shell sort with an example?
_ Explanation
_ Example
_ Figure
_ Coding
UNIT-V
PART-A

1.Define Graph?
A graph G consist of a nonempty set V which is a set of nodes of the graph, a set E which is the
set of edges of the graph, and a mapping from the set for edge E to a set of pairs of elements of
V. It can also be represented as G=(V, E).
2. Define adjacent nodes?
Any two nodes which are connected by an edge in a graph are called adjacent nodes. For
example, if and edge xÎE is associated with a pair of nodes (u,v) where u, v Î V, then we say that
the edge x connects the nodes u and v.
3. What is a directed graph?
A graph in which every edge is directed is called a directed graph.
4. What is a undirected graph?
A graph in which every edge is undirected is called a directed graph.
5. What is a loop?
An edge of a graph which connects to itself is called a loop or sling.
6.What is a simple graph?
A simple graph is a graph, which has not more than one edge between a
pair of nodes than such a graph is called a simple graph.
7. What is a weighted graph?
A graph in which weights are assigned to every edge is called a weighted
graph.

M.Suganthy A.P/CSE Dr.SJSPMCET Page 26


University Questions

8. Define out degree of a graph?


In a directed graph, for any node v, the number of edges which have v as
their initial node is called the out degree of the node v.
9. Define indegree of a graph?
In a directed graph, for any node v, the number of edges which have v as
their terminal node is called the indegree of the node v.
10. Define path in a graph?
The path in a graph is the route taken to reach terminal node from a starting
node.
11.What is a simple path?
A path in a diagram in which the edges are distinct is called a simple path.
It is also called as edge simple.
12. What is a cycle or a circuit?
A path which originates and ends in the same node is called a cycle or circuit.
13. What is an acyclic graph?
A simple diagram which does not have any cycles is called an acyclic graph.
14. What is meant by strongly connected in a graph?
An undirected graph is connected, if there is a path from every vertex to every other vertex. A
directed graph with this property is called strongly connected.
15. When is a graph said to be weakly connected?
When a directed graph is not strongly connected but the underlying graph is connected, then the
graph is said to be weakly connected.
16. Name the different ways of representing a graph?
a. Adjacency matrix
b. Adjacency list
17. What is an undirected acyclic graph?
When every edge in an acyclic graph is undirected, it is called an undirected
acyclic graph. It is also called as undirected forest.
18. What are the two traversal strategies used in traversing a graph?
a. Breadth first search
b. Depth first search

M.Suganthy A.P/CSE Dr.SJSPMCET Page 27


University Questions

19. What is a minimum spanning tree?


A minimum spanning tree of an undirected graph G is a tree formed from graph edges that
connects all the vertices of G at the lowest total cost.
20. What is NP?
NP is the class of decision problems for which a given proposed solution for a given input can be
checked quickly to see if it is really a solution.
PART-B
1.Explain the various representation of graph with example in detail?
_ Adjacency matrix
• Figure
• Explanation
• Table
_ Adjacency list
• Figure
• Explanation
• Table
2. Define topological sort? Explain with an example?
_ Definition
_ Explanation
_ Example
_ Table
_ Coding
3. Explain Dijkstra's algorithm with an example?
_ Explanation
_ Example
_ Graph
_ Table
_ Coding
4.Explain Prim's algorithm with an example?
_ Explanation
_ Example

M.Suganthy A.P/CSE Dr.SJSPMCET Page 28


University Questions

_ Graph
_ Table
_ Coding
5. Explain Krushal's algorithm with an example?
_ Explanation
_ Example
_ Graph
_ Table
_ Coding

M.Suganthy A.P/CSE Dr.SJSPMCET Page 29

You might also like