Sunteți pe pagina 1din 27

MCS-021-2010d.pdf

MCS-021 - 2013 d.PDF

MCS-021-2014j.PDF

MCS-021-2014d.PDF

MCS-021-2013J.pdf

MCS-021-2012j.pdf

MCS-021-2012 D.pdf

MCS-021-2011j.pdf

MCS-021-2011d.pdf

MCS-021-2010j.pdf   No. of Printed Pages : 2

MCA (Revised)

Term-End Examination

December, 2013

MCS-021

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours

Maximum Marks : 100 (Weightage 75%)

Question number 1 is Compulsory. Attempt any three questions from the rest. All algorithms should be written

nearer to 'C' language.

Note :

1.

(a) Write an algorithms for the insertion and 10 deletion operations on the circular queue.

 (b) Write a procedure to create, insert and 10 display the content of a doubly linked list (c) Explain "Depth First Search" Algorithm 10 with an example. (d) What is the need for external sorting ? 10 Explain any one method to perform external sorting.

2.

3.

(a) Is it possible to implement multiple stocks 10 using a Single Dimensional Array ? Justify your answer. (b) Write an algorithm for sorting whose 10 average and best time complexities are same.

(a) Create a binary search tree for following numbers start from empty BST 45, 26, 10, 60, 70, 30, 40.

10

MCS-021

1

P.T.O.

(b) Write Prim's algorithm for constructing Minimum Cost Spanning Tree and trace the algorithm for the following graph.

4. (a) Define the following term with an example : AVL trees.

10

10

(b) Explain the process of converting any Tree 10 into a Binary Tree.

5. (a) Write an algorithm for the addition of two 10 matrices using Single Dimensional Arrays.

(b) Propose a representation for a polynomial. Explain the advantages of such representation.

10

No. of Printed Pages : 2

MCS-021

MCA (Revised) / BCA (Revised)

Term-End Examination

June, 2014

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours

Maximum Marks : 100 (Weightage 75%)

Note : Question number 1 is compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to 'C' language.

1.

(a) Prove by induction that

10

 (i) The number of leaves in a binary tree of height 'h' are less than or equal to 2h. (ii) The number of nodes in a full binary

tree of height 'h' are equal to (2h+1 _ 1).

 (b) Write an algorithm to implement Doubly 10 Linked List. (c) Compare Heap sort and Quick sort with 10 each other. (d) Write an algorithm for addition of two 10 Sparse Matrices.

2.

(a) Write an algorithm for insertion sort. Write 10 step by step working of the algorithm for the following set of data. 43, 16, 11, 89, 32, 46, 1, 88 (b) What is a splay tree ? Write the steps 10 involved in a top-down splaying procedure.

MCS-021

1

P.T.O.

3.

(a) How is a circular queue better than a linear 10 queue ? Also, write functions for adding and removing an element from the circular queue.

(b)

Write an algorithm for implementing a 10 singly linked list using arrays.

4. Write prim's algorithm for constructing a 10 minimum cost spanning tree and trace the algorithm on the following network.

(a)

(b)

Discuss the various file organisation methods. Also, list the advantages and disadvantages of each.

10

5. Explain the depth first search algorithm 10 with an example.

What are Red-Black Trees ? What is their 10 significance ?

(a)

(b)

No. of Printed Pages : 3

MCS-021

MCA (Revised) / BCA (Revised) Term-End Examination

December, 2014

MCS-021 : DATA AND FILE STRUCTURES

Maximum Marks : 100 (Weightage 75%)

Note : Question number 1 is compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to 'C' language.

Time : 3 hours

1. (a) Consider the algorithm given below :

10

 (i) scanf ("%d", &n); (ii) {for (int i = n; < = n * n; i = n + 10) (iii) (for (int j = 1; j < = n; j++) (iv) printf ("%d", n/i + j);}}

Calculate the complexity (both space and time) of the above code by using Big "0" notation.

 (b) Define sparse matrix. Write an algorithm that accepts a 6 x 5 sparse matrix and outputs in 3-tuple representation. 10 (c) Write an algorithm for Heapsort. Write step by step working of algorithm for the following set of data : 10

9, 16, 43, 27, 91, 33, 21, 7, 3

MCS-021

1

P.T.O.

 (d) Draw AVL tree by inserting the following elements one by one : 7, 13, 27, 9, 11, 14, 8, 37, 24 10 2. (a) Write Floyd-Warshall's algorithm for computing "All pair shortest path" problem. Show how does your algorithm work for the following graph : 10 (b) Write an algorithm for inserting a node in a Red-Black tree. Write step by step working of algorithm using an example. 10 3. (a) Write an algorithm for adding two polynomials. Algorithm should take the two polynomials as input and display the resultant polynomial. 10 (b) Write an algorithm for array implementation of a circular queue. 10

MCS-021

2

P.T.O.

4. (a) Write an algorithm to insert and delete a node from a doubly-linked list.

(b) Write an algorithm to insert an element into a B-tree. Make B-tree using your algorithm for the following list of elements :

10

10

22, 29, 8, 34, 17, 89, 11, 19

5. (a) Compare any two file organisations.

(b) What is a BST ? Explain with an example. What are its limitations ?

10

10

No. of Printed Pages : 2

C.N

MCA (Revised)

Term-End Examination June, 2013

MCS-021

MCS-021 : DATA AND FILE STRUCTURES

Maximum Marks : 100 (Weightage 75%)

Note : Question number 1 is Compulsory. Attempt any three questions from the rest. All algorithms should be written

Time : 3 hours

1.

2.

nearer to 'C' language.

(a)

(b)

(c)

(d)

Design algorithms for various operations performed on circularly linked list.

10

What are the advantages of using lists than 10 arrays while implementing a stack ? Explain.

Write a procedure to find minimum cost 10 spanning tree for a graph using Prim's algorithm.

Explain the process of creating a Splay Tree using an example.

10

(a) Write a procedure to create, insert and

10

display the content of a singly linked list.

3.

10

(b) Propose any two representations for Sparse Matrices and compare them.

(a) Write a procedure to create, insert and 10 delete an element in queue.

MCS-021

1

P.T.O.

(b) Explain the all-pairs shortest path problems 10 with algorithm and trace the algorithm for the following digraph :

4. (a) Write a procedure to sort the following sequence : 25 57 48 37 12 92 86 33. Use Heap Sort.

10

(b) Write the algorithms for each of the 10 following for binary trees :

(i) Inorder traversal Preorder traversal Postorder traversal

5. (a) Enumerate different file organizations. 10 Explain any two file organizations with examples. (b) Discuss any two applications of red-black 1 0 trees in detail.

No. of Printed Pages : 3

MCS-021

r--

O

O

MCA (Revised)

Term-End Examination

June, 2012

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours

Note :

Maximum Marks : 100 (Weightage 75%)

Question number 1 is Compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to C language.

1.

(a) What are the pre conditions for applying binary search on any list containing Integer values ? Write the algorithm and manually run it on the following list of number :

10 27 2.3-56 38 66 45

10

What is worst case complexity of the above algorithm ?

(b) Differentiate between AA trees and Red - Black frees ? Construct an AA - Tree using the following nodes. Show all intermediate steps and balancing of tree. °

10

17, 4, 25, 98, 28, 33, 42, 11, 6, 73

MCS-021

1

P.T.O.

(c)

Consider the following matrix :

 5 6 21 X= 8 2 4 1 3 6 3x3

Write the steps involved in calculating the rank of X.

Write an algorithm to find the transpose of X.

(d) Write an algorithm that sort a given linked list of integers. Also, write a function that splits this linked list into a linked list of even integers and a linked list of odd integers.

(i)

2. (a) Construct a binary tree using the following pre - order and in - order trasversals :

5

5

10

10

Pre-order:ABGHMCDEF

(b) Write an algorithm for multiplication of two sparse matrices.

3. (a) Explain the shell sorting technique with an example. Give the complexity of above technique in terms of comparisions and storage required for both best and worst cases.

MCS-021

10

10

 (b) Write the functions to perform Push and Pop operations of stack using pointers. Using above functions, write an algorithm to convert a given infix notation to its equivalent postfix notation. 10 4. Write an algorithm to find the frequency 10 (occurance of words) from a give text tile. The list of words and their corresponding frequency should be in the alphabetical order of words. (a)

(b) Explain the different types of file organisations available. Also, explain one advantage and one disadvantage of each.

10

5. Using Dijkstra's algorithm, find the shortest 10 path between A and F for the following graph. Show the intermediate steps also.

(a)

B

(b)

E

Write short notes on the following with an

example :

 (i) AVL tree- (ii) Circular Queue

5x2=10

Lc)

71. O

O

No. of Printed Pages : 3

MCS-021

MCA (Revised)

Term-End Examination

December, 2012

MCS-021 : DATA AND FILE STRUCTURES

Maximum Marks : 100 (Weightage 75%)

Note : Question number 1 is Compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to 'C' language.

Time : 3 hours

1.

(a) Prove by Induction that :

 (i) The number of leaves in a binary tree of height "h" is less than or equal to 211. (ii) The number of nodes in full binary tree

of height is equal to 2h+1 - 1.

5

5

 (b) Show step-by-step construction of a B-Tree 10 (t=3) resulting from the insertion of the following keys. A, S, T, M, U, K, L, B, G, N Also, show deletion of Key 'U' and 'K' from the B-Tree constructed above. (c) Write an algorithm to sort "N" numbers 10 using Bubble sort. Also, show that bubble sort algorithm, on average, makes 0(N2) comparisions while sorting a list of N elements.

MCS-021

1

P.T.O.

(d)

What is a height-balanced tree ? Construct an AVL tree for the following elements :

10

6, 3, 15, 24, 7, 89, 12, 34, 2 Show all intermediate steps.

 2. (a) What is a Dequeue ? Write an algorithm to insert and delete the node in a Dequeue. 10 (b) Write an algorithm to implement Heap using linked list. The algorithm should clearly perform PUSH and POP operation. 10 3. (a) Write recursive algorithm for preorder, 10 inorder and post order traversal of a Binary tree. Also, give an example to show the traversals. (b) Construct a Red-Black tree from the following set of data items. 11, 9, 7, 27, 8, 100, 22, 92 Also, show step - by - step procedure to delete "100" from the constructed tree. 10 4. (a) Write an algorithm to reverse the order of nodes in a doubly linked list with header node. 10 (b) Differentiate between the Kruskal's and prim's algorithm based on their principle, operation and running time. Also, write any two applications of minimum cost spanning tree. 10

5. (a) Differentiate between Indexed file 10 organisation and Indexed sequential file organisation. Also, write any four disadvantages of sequential file organisation. (b) Write short notes on the following with an

5x2=10

example of each :

 (i) Multiple stacks (ii) AA-Tree

No. of Printed Pages : 2

MCS-021

N

0

00

0

MCA (Revised)

Term-End Examination

June, 2011

MCS-021 : DATA AND FILE STRUCTURES

Maximum Marks : 100 (Weightage 75%)

Note : Question number 1 is Compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to C language.

Time : 3 hours

1.

(a) Elaborate various asymptotic notations used 10 to evaluate the efficiency of the algorithm.

Explain in detail the push and pop

10

operations in a stack.

Explain in brief the AVL tree rotations. 10

Solve the following instance of single source shortest paths problem with vertex 'a' as the source.

10

(c)

(b)

(d)

MCS-021

1

P.T.O.

 2. (a) Write a program that accepts two polynomials as input and displays the resultant polynomial diie to the addition of input polynomials. (b) Explain the recursive algorithm for each of the binary tree traversals. Construct the path for each of above traversals for the following example. 3. (a) Write an algorithm for array implementation of a circular queue. (b) Explain the concepts of breadth first search with example. 4. (a) Explain in detail the binary search with example. (b) Describe the Quick sort algorithm. 5. (a) Give an example for various operations of AA-Trees. (b) Write a detailed note on file organization techniques.

10

10

10

10

10

10

10

10

No. of Printed Pages : 2

MCS-021 I

MCA (Revised) Term-End Examination

December, 2011

tr)

kn

C

CD MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours

Note :

Maximum Marks : 100 (Weigh tage 75%)

Question number 1 is Compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to C language.

1. (a) Write an algorithm for implementing 10 insertion and deletion operations in a singly linked list using arrays.

 (b) What are the various operations in a 10 queue ? Explain each of them. (c) Write prim's algorithm for constructing a 10 minimum cost spanning tree and trace the algorithm on the following network. (d) With relevant example, explain the splaying procedure in detail. 10

2. Describe the relationship between asymptotic notations with a neat sketch.

Explain in detail the algorithmic implementation of multiple stacks.

3. Explain the depth first search algorithm with example.

Write Floyd's algorithm for all-pairs shortest path algorithm.

(a)

(b)

(a)

(b)

4. Discuss about the linear search in detail.

(a)

(b)

Apply heap sort for the following unordered elements

2, 3, 81, 64, 4, 25, 36, 16, 9, 49,

10

10

10

10

10

10

5. Explain the operations of Red-Black Trees. 10

10

(a)

(b)

Write a detailed note on sequential file organization.

No. of Printed Pages : 3

I MCS-021 I

MCA (Revised)

cV Term-End Examination

•14

"1"

O

June, 2010

MCS-021 : DATA AND FILE STRUCTURES

Maximum Marks : 100 (Weightage 75%)

Note : Question number 1 is Compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to C language.

Time : 3 hours

 1. (a) Write a program to store the roll numbers 15 and names of students in a binary search tree. Write a function to accept a number and display the name of the student, whose roll number matches with this number. Give suitable messages if the roll number does not exist in the binary search tree. (b) Consider the algorithm given below : 10

Scanf ("%d"; & max); {for (int i =1; i< = max; i + + ){ for (int j =1; j<= max; j + + ) Printf ("%d", i * j); Calculate the complexity (both space and time) of the above code by using Big '0' notation.

 Write a program to simulate a circular queue using pointers with functions for insertion, deletion. (Use singly linked list). 10 Write an algorithm for pushing an element into a stack. 5
 (a) Write a program to find the frequency of 15 words in a given text. The list of words and their corresponding frequency should be in the alphabetical order of words. (b) Explain the properties and operations of AA trees. 5

(a) What is a sparse matrix ? What is its 3-tuple 10 representation ? Also, write an algorithm that accepts 5x4 sparse matrix and outputs its 3 tuple representation.

(b) Find minimum cost spanning tree from the 10 following graph using Prim's Algorithm.

 (a) Show step by step construction of an AVL 10 tree resulting from the inserting of the following sequence of keys. 10, 3, 18, 4, 6, 8, 16, 14 Now, Delete key "8" from the constructed AVL tree and show the resultant tree. (b) What are the essential features of a binary 10 tree ? Explain, how a general tree can be converted into a binary tree ? (a) Pre-order traversal of a certain binary tree 10 produces ADFGHKLPQRWZ and in order traversal produces : GFHKDLAWRQPZ Using Pre-order and in-order traversal, draw the corresponding binary tree. (b) Write an algorithm to balance a Red-Black 10 tree after deleting a node. 