The number of edges in a complete graph with 'n' vertices is
Official theoretical question paper for Data Structure Algorithms (PCC-CS301) conducted by Maulana Abul Kalam Azad University of Technology. All questions from Groups A, B, and C are reproduced below with marks weightings.
The number of edges in a complete graph with 'n' vertices is
Which of the following data structures is used to implement recursion?
In what tree, for every node the heights of its left sub-tree and right sub-tree differ at least by one?
Which traversal technique lists the nodes of a binary search tree in ascending order?
The equivalent postfix expression for d/(e + f) + b * c is
If the postfix form of a string is ABC + - D *, the actual string is
The following sequence of operations is performed on a stack : push(1),push(2),pop,push(1),push(20),pop,pop,pop,(push(2),pop. The sequence of popped out values is
A linear collection of data elements where the linear node is given by means of pointer is called
p is a pointer to the structure. A member "mem" of that structure is referenced by
In linked list representation a node contains at least
In quick sort a desirable choice for the partitioning element will be
An adjacency matrix representation of a graph cannot contain information of
Given a strictly binary tree with N leaves. Let 1 (i) for i = 1 to N equals the level of ith leaf. Prove that $\sum 1 / (pow(2,1(i))) = 1$.
Discuss the advantages of doubly linked list as compared to single linked list. Write an algorithm to append a new node after the specified node in a doubly linked list.
What are row-major order and column-major order representations? Find the address of element $a_{y}$, in both representations. Given Base address : B Width of each element : w Row index 'i' is specified as : $L_r \le i \le U_r$ Column index 'j' is specified as : $L_c \le j \le U_c$.
a) Define $O(f(n))$, $\Omega(g(n))$ and $\Theta(h(n))$. b) Let $f(n) = 4n^2 - 5n + 6$ and $g(n) = n^2$. Show that $f(n) = O(g(n))$.
How polynomials can be represented using linked list? Write an algorithm to add two polynomials.
a) Explain ADT (Abstract Data Type). Create the ADT list to represent integer linked list. b) Write the algorithms for the following in single linked list : 4 + 4 i) Delete a node with specified value from the list. ii) Reverse the links of the list i.e. the first node becomes last node. c) Compare and contrast Array & Linked List.
a) What is recursion? Distinguish between primitive and non-primitive recursions. What is tail recursion? 2 + 3 + 1 b) "Iteration is a better choice than recursion." Critically comment on this statement. 4 c) A robot can make steps of three different lengths : 1 cm, 2 cm and 3 cm. Write a recursive algorithm to find the number of different ways the robot can traverse the distance d.
a) Define General Tree and Binary Tree. Discuss how a binary tree is constructed from a given general tree. 4 b) Write the algorithm for comp_tree() which has two arguments S, T and return TRUE if binary trees S and T are equal otherwise return FALSE. 3 c) Prove that for any non-empty binary tree T, if $N_0$ is the number of terminal nodes and $N_2$ the number of nodes of degree 2, then $N_0 = N_2 + 1$. 4 d) The pre-order and in-order traversals of a binary tree are given below : Pre-order : A B C D E F G H I In-order : B C A E D G H F I Construct the tree. 4
a) What is priority queue? Discuss various ways to represent priority queue. Write an algorithm to add an ITEM with priority number N to a priority queue which is maintained by a two-dimensional array QUEUE. 2 + 2 + 3 b) Write the algorithm to convert an infix expression to equivalent reverse-polish expression. Use the following expression to illustrate the algorithm : $A * (B + D) / E - F * (G + H / K) \Box X$ 5 + 3
a) Explain how divide and conquer technique is applied to quick sort algorithm. 2 b) Write the quick_sort() algorithm. 5 c) Analyze the algorithm in worst case, best case and average case situations. 6 d) State different ways of pivot selection. 2
a) Define the Fibonacci binary tree of order n as follows : If n = 0 or n = 1, the tree consists of a single node. If n > 1, tree consists of a root with the Fibonacci tree of order n - 1 as left subtree and the Fibonacci tree of order n - 2 as right subtree. i) Is such tree a strictly binary tree? ii) What is the number of leaves of such tree for any value n ? iii) What is the depth of the tree? iv) Write a recurrence relation to calculate the total number of nodes in the tree with proper initial condition. 1 + 2 + 2 + 2 b) What is DAG ? What do you mean by topological ordering? 2 + 2 c) Draw the DAG to represent the following arithmetic expression : $((a + b) * c) - (d / (a + b))) * ((a + b) * c)$.