Vous êtes sur la page 1sur 13

G 7053

M.E. DEGREE EXAMINATION, JANUARY 2006


First Semester
Computer Science and Engineering
CS 1602 DATA STRUCTURES AND ALGORITHMS
(Regulation 2005)
Time : Three hours

Maximum : 100 marks


Answer ALL questions

PART A (10 x 2 = 20 marks)

1. What is an Abstract Data Type?


2. What is Pointer? Compare it with cursor.
3. What is the minimum number of nodes in AVL tree of height 15?
4. What is the postfix equivalent of the infix expression a + b * c + (d * e + f) * g ?
5. Define Priority Queue.
6. What is chromatic number of a graph G?
7. What is garbage collection?
8. What is buddy system? List its advantage.
9. What are the running times of Quick Sort and Merge Sort for presorted input?
10. State Greedy algorithm.

PART B (5 x 16 = 80 marks)

11.
i. A and B are two sorted linked lists. Write an algorithm to create new linked
list C that contains all data in A, B without duplicates in sorted order.

(6)

ii. Formulate an algorithm to multiply two polynomials P1, P2 using linked list
implementation. Explain with suitable example.

(10)

12.
(a)
i. Write an algorithm to insert and delete from the ith stack when multiple stacks
are represented in a single array. Check for Stack Full condition.

B.BHUVANESWARAN / REC

(6)

Page No. : 1

ii. Show the results of inserting 3, 2, 1, 4, 5, 6, 7, 9, 6, 15, 14, 13, 12, 11, 10, 8
and 9 into initially empty AVL tree. Explain with neat algorithm.

(6)

iii. Write an algorithm for insertion in B-Tree.

(4)

Or
(b)
i. Two binary trees are similar if they are both empty or both non empty and
have similar left and right subtrees. Write an algorithm to decide whether two
binary trees are similar.

(10)

ii. Write a non-recursive algorithm for post order tree traversal. Perform time
analysis for your algorithm.

(6)

13.
(a)
i. Write an algorithm to find the smallest and largest element in a given set S. (8)
ii. Give an algorithm to find the minimum number of edges that need to be
removed from an undirected graph G so that the resulting graph is acyclic. (8)
Or
(b)
i. How do you remove data from a priority queue? Explain the application of
priority queue.

(6)

ii. Explain the Prims algorithm and apply to the following graph.

10

11
2

E
2
H

1
4

5
6

(10)

2
F
3

1
G
11
2

8
J

14.
(a)
i. Explain an efficient method for garbage collection of equal sized blocks.

(8)

ii. Explain the buddy system of memory management in detail.

(8)

Or

B.BHUVANESWARAN / REC

Page No. : 2

(b)
i. Discuss the problems in allocating and freeing space in each memory
management scheme.

(8)

ii. Explain the different techniques for implementing storage compaction.

(8)

15.
(a)
i. Explain the heap sort algorithm for sorting a list of n values and perform the
time analysis.

(6)

ii. Explain the Optimal Binary Search Tree with an example and algorithm.

(6)

iii. Explain about local search algorithms.

(4)

Or
(b)
i. What is external sorting? Explain the polyphase sort with example.

(6)

ii. In the game of chess, a Knight in row R and column C may move to row
1<R<B and column 1<C<B (Where B is the size of the board) provided that
either
|R-R| = 2 and |C-C| = 1
Or
|R-R| = 1 and |C-C| = 2
A Knights tour is a sequence of moves that visits all sequences exactly one
before returning to the starting point. Give a backtracking algorithm to find
knights tour.

(10)
__________

B.BHUVANESWARAN / REC

Page No. : 3

Q 8099
M.E. DEGREE EXAMINATION, MAY / JUNE 2006
First Semester
Computer Science and Engineering
CS 1602 DATA STRUCTURES AND ALGORITHMS
(Regulation 2005)
Time : Three hours

Maximum : 100 marks


Answer ALL questions

PART A (10 x 2 = 20 marks)

1. What is information hiding?


2. What are the applications of linked list?
3. Convert the expression (a + b) * (c + d) / (e * f) to prefix expression.
4. Construct an expression tree for the expression ab + cde + * *.
5. What are the methods used for implementing priority queue?
6. What is an AVL tree?
7. Define Garbage collection.
8. What is buddy system? List its disadvantage.
9. What is the running time of insertion sort if all elements are equal?
10. What are the applications of Greedy algorithm?

PART B (5 x 16 = 80 marks)

11.
i. Write a non-recursive function to reverse a singly linked list in O(N) time. (6)
ii. Given two sorted list L1 and L2, write an algorithm to computer L1L2.

(5)

iii. Formulate an algorithm to search an element in a doubly linked list.

(5)

12.
(a)
i. Write an algorithm to convert a postfix expression to infix.

(8)

ii. Formulate an algorithm to perform deletion from a B-tree.

(8)

Or

B.BHUVANESWARAN / REC

Page No. : 4

(b)
i. Show that the maximum number of nodes in binary tree of height h is 2 h+1 1
with an example.

(8)

ii. Keys1, 2, 2k 1 are inserted in order into an initially empty AVL tree.
Prove that the resulting tree is perfectly balanced.

(6)

13.
(a)
i. Propose an algorithm to insert M nodes into a binary heap on N elements.
Perform time analysis for your algorithm.

(8)

ii. Given an algorithm to find an undirected (Connected) graph path that goes
through every edge exactly once in each direction.

(8)

Or
(b)
i. Write an algorithm to find the largest element in a set S

(6)

ii. Explain the Dijkstras algorithm and apply to the following graph.

(10)

1
B
5

G
3

F
6

14.
(a)
i. Discuss the memory management issues in detail.

(8)

ii. Explain the storage compaction algorithm.

(8)

Or
(b)
i. Discuss the method of allocating storage for objects with mixed sizes

(8)

ii. Explain the different types of buddy systems in detail

(8)

B.BHUVANESWARAN / REC

Page No. : 5

15.
(a)
i. Consider the problem of placing eight queens on an (eight by eight) chess
board. Two queens are said to attack each other if they are on the same row,
column, or (not necessarily main) diagonal. Give a backtracking algorithm to
solve the above problem.

(8)

ii. In the analysis of merge sort, constants have been disregarded. Prove that the
number of comparisons used in the worst case by merge sort is
N[log N] 2[log N] + 1.

(8)
Or

(b)
i. Write an algorithm that reads in two alphabetized files and merges them
together forming a third alphabetized file.

(8)

ii. You are a tournament director and need to arrange a round robin tournament
among n = 2k players. In this tournament, everyone plays exactly one game
each day. After n 1 days, a match has occurred between every pair of
players. Give an algorithm to do this.

(8)

__________

B.BHUVANESWARAN / REC

Page No. : 6

W 2579
M.E. DEGREE EXAMINATION, JANUARY 2007
First Semester
Computer Science and Engineering
CS 1602 DATA STRUCTURES AND ALGORITHMS
(Regulation 2005)
Time : Three hours

Maximum : 100 marks


Answer ALL questions

PART A (10 x 2 = 20 marks)

1. Write a generic format to find maximum of 2 integers, 2 float, 2 characters.


2. What is a cursor? Give an example.
3. State any two applications of stack.
4. Explain a method to represent tree. Give an example.
5. What is a priority queue?
6. What is connected graph? Give an example.
7. Differentiate first-fit and best-fit strategy.
8. What is reference count?
9. How does Binary search work?
10. Explain where backtracking is applicable.

PART B (5 x 16 = 80 marks)
11.
(a)
i. Write an algorithm to insert into a doubly linked list. Insertion should be to
enable first node insertion, last node insertion and in the middle.

(8)

ii. Write algorithms to reverse a singly linked list and to count the number of
nodes.

(8)
Or

(b)

Explain any 6 characteristics of OOP.

B.BHUVANESWARAN / REC

(16)

Page No. : 7

12.
(a)
i. Write an algorithm to implement stack operations Push and Pop.

(8)

ii. Write any two tree traversal algorithm and apply it the figure given below: (8)
A

Or
(b)
i. Write an algorithm to implement Queue operations.

(8)

ii. Explain how insertion and deletion takes place in AVL trees.

(8)

i. Explain how sets are implemented.

(6)

13.
(a)

ii. Write an algorithm to find spanning tree and apply it to figure given below:
(10)

1
6

5
1

5
3

3
6
5

Or

B.BHUVANESWARAN / REC

Page No. : 8

(b)
i.

Apply DFS and BFS and find the resultant.

(8)

ii. Write a shortest path algorithm and apply it to the figure given.

(8)

1
10

100
30

50

60

10
3

20

14.
(a)
i. Write and explain the garbage collection algorithm for equal sized blocks. (8)
ii. Explain how compaction can be implemented.

(8)

Or
(b)
i. Explain how storage allocation for objects of mixed sizes is implemented. (8)
ii. Write a note on buddy systems.

B.BHUVANESWARAN / REC

(8)

Page No. : 9

15.
(a)
i. Explain how divide and conquer algorithm is applied to Tower of Hanoi.

(8)

ii. Write the Bubble sort algorithm and apply it to sort the key set.

(8)

42, 23, 74, 11, 65, 58, 94, 36, 99, 87


Or
(b)
i. Explain how greedy algorithm is applied to Traveling Salesman problem.
ii. Construct a heap for the key set:

(6)
(10)

42, 23, 74, 11, 65, 58, 94, 36, 99, 87


__________

B.BHUVANESWARAN / REC

Page No. : 10

G 6160
M.E. DEGREE EXAMINATION, MAY / JUNE 2007
First Semester
Computer Science and Engineering
CS 1602 DATA STRUCTURES AND ALGORITHMS
(Regulation 2005)
Time : Three hours

Maximum : 100 marks


Answer ALL questions
PART A (10 x 2 = 20 marks)

1. Define ADT Pointer.


2. How many pointers need to be modified in the following operations:
a. Insert an element at the beginning of a singly linked circular list with head
node.
b. Delete an element in the middle of a circular doubly linked chain.
c. Delete an element at the beginning of the circular singly linked list with tail
pointer.
d. Delete an element at the middle of the doubly linked circular list with head
pointer.
3. Binary Search trees the best worlds of arrays and linked lists into one structure.
Comment.
4. How do array based circular queue compares with linked circular queues?
5. Compare any two dorm SET implementation.
6. Is a graph linear or non-linear or hierarchical form of data structure? Justify your
answer.
7. Compare and contrast internal fragmentation and external fragmentation in memory
management.
8. Enumerate the merits and demerits of automatic garbage collection.
9. What do you mean by stable sorting algorithm? Give an example for a stable sorting
algorithm and an application where we need it.
10. Compare and contrast Divide and Conquer and Backtracking algorithm design
approaches.

B.BHUVANESWARAN / REC

Page No. : 11

PART B (5 x 16 = 80 marks)

11.
(a)
i. Explain how to add and delete an element from a double linked chain with
head pointer.

(10)

ii. Let P be a pointer to a singly linked list and Q is a pointer. Find out the effect
of the following statements. Each node consists of two fields namely Data and
Next. Next field is points to the same node type.
Q = P Next
P Next = Q Next
P Next = (Q Next) Next
(P Next) Next = Q

(6)
Or

(b)
i. Discuss any possible scheme to implement the following:

(10)

1. Dynamic Array Number of values and data type of the array elements
are decided at run time.
2. Varying Array Number of values decided at run time and data type and
maximum number of values are decided at translation time.
ii. Write a critical essay about for and against the Pointer type. Enumerate
common errors in pointer usage.

(6)

12.
(a)

Write and explain an algorithm that takes two strings of alphabets. One string
represents an in order traversal of a binary tree in which each node contains one
alphabet; the second string represents a pre order traversal of the same tree.
Assume that no two nodes of the tree contain the same letter. The algorithm is to
determine whether there can be such tree. If there is a tree, output a string that
represents the post order traversal of the tree.

(16)

Or

B.BHUVANESWARAN / REC

Page No. : 12

(b)
i. Write and explain a recursive algorithm to convert the PREFIX form
expression into POSTFIX form of the expression. Trace this with simple
example.

(10)

ii. Discuss an application for each type of queue data structures.

(6)

13.
(a)

Write an algorithm which helps for a railway passenger to know whether there
exists a path from a given city to a another city i.e. does there exists a railway
link direct or indirect. Which way graph represented in memory? Why? Explain.
(16)
Or

(b)

Explain an algorithm how a Heap tree can be used to implement a priority


queue. Give simple example. Find out the time complexity for insertion and
deletion operation.

(16)

14.
(a)
i. Discuss the impact of equal size and mixed size blocks based storage
allocation.

(10)

ii. Identify the various data structures possible to use for Memory management.
(6)
Or
(b)

Explain the various aspects of Buddy systems and Storage Compactions.

(16)

15.
(a)

Explain how to implement merge sort with and without recursion. Analyze the
performance both.

(10 + 6)
Or

(b)

Explain any TWO of the following:

(8 + 8)

i. Abstraction and software development.


ii. Algorithm design techniques.
iii. Notations for Algorithm analysis.
__________

B.BHUVANESWARAN / REC

Page No. : 13

Vous aimerez peut-être aussi