Beruflich Dokumente
Kultur Dokumente
Assignment 8
Data structures (CSE-A & CC-A)
Deadline: - (25-11-16)
Submit this assignment in Hard Copy
1
a
b
c
a
b
Write down a C program to find the frequency of each element in an array and display elements in
ascending order of frequency.
Write down the advantages and dis-advantages of Array and Linked list in tabular format.
Convert the following infix expression into postfix expression by stack.
(A+B^C)*D+E^F
Write down a program to interchange the value of first element with the last element, second element with
the second last element and so on so forth of a doubly linked list.
Write down the pseudo code for a function to insert in a static circular Queue containing Players
information (represented with the help of array of structure PLAYER). Assume the following definition
of MYNODE for the same:
struct PLAYER
{ int PID;
char Pname[20];
char Gender;
};
Given the following sequence of letters and asterisks: EAS*Y*QUE***ST***IO*N***
(1) Consider the stack data structure, supporting two operations push and pop. Suppose that for the above
sequence, each letter (such as E) corresponds to a push of that letter onto the stack and each asterisk (*)
corresponds a pop operation on the stack. Show the sequence of values returned by the pop operations.
(2) Consider the queue data structure, supporting two operations insert and remove. Suppose that for the
above sequence, each letter (such as E) corresponds to an insert of that letter into the queue and each
asterisk (*) corresponds a remove operation on the queue. Show the sequence of values returned by the
remove operations.
Write a recursive pseudo code to exchange the value of left child with parent node followed by exchange
of value of right child with that of parent node in a BST (Binary Search Tree). Output binary tree need not
to be a BST.
Find the minimum spanning tree by using Prims Algorithm (Start Node:- 3).
How to efficiently implement k stacks in a single array? Explain with example
b
c
c
6
Write down a pseudo code to implement a priority queue for handling the processes. The execution of
processes depends on the start time if more than one processes have same start time then the priority
number will be considered and also display the sequence of processes. [sequence of execution for
following data is P1->P3->P2->P4]
Process
Start Time
Priority Number
P1
P2
0
1
5
3
P3
P4
1
2
2
5
Sort the following list using merge sort. Show all steps clearly
27, 17, 28, 32, 15, 19, 8, 10, 20
Construct a binary tree T that has 9 nodes. The in-order and pre-order traversal of T yields the following
sequence of nodes:
In-order
: 5 1 3 9 6 8 4 2 7
Pre-order
: 6 1 5 9 3 4 8 7 2
Find the Post-order sequence also.
Take the list
40, 56, 28, 79, 20, 18, 67, 56.
Construct a min heap showing all the steps and write algorithm for insertion and deletion
Construct an AVL tree in step by step manner for the following set of elements
5, 12, 62, 25, 29, 30, 18, 34, 42, 19. After construction delete elements 25 and 30 to obtain final balanced
AVL tree.
Why the complexity of hashing is O (1)? Explain with example.
Evaluate BFS and DFS order for the graph shown in figure. Describe the steps in detail for both the
traversals. (start node:- B)
Construct a B-tree of order-5 in step by step manner1, 7, 6, 2, 11, 4, 8, 13, 10, 5, 19, 9, 18, 24. Further delete elements 11 and 13 and obtain the final 5-order
B-tree.