Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
USN 1 S
UNIT-I
2. a) i) Find the final values stored in the variables x,y,z at the end of the, (06)
program.
void main()
{
int x,y,z, *p, *q;
x=10;
y=15;
z=20;
p=&x
q=&z;
*q=*p+y_3;
Y=Y-(*P);
*p=*q_z;
}
Page 1 of 4
EC401
What is the output of the following code?
main()
{
static int a[5]={2,4,6,8,10};
int i, b=5;
for (i=0;i<5;i++)
{
f(q[i],&b);
printf("%d, %d\n",a[i],b);
}
UNIT - II
3. a) What is a graph? Explain adjacency matrix and linked list (07)
representation of a graph with suitable example.
b) Write a C program to sort N integer numbers using address (08)
calculation sort (Hash sort).
c) What is sequential search? Explain with suitable example. (05)
4. a) Explain breadth first traversal and depth first traversal with suitable (06)
example.
b) For the given following graph G shown in Fig.4b. find its minimum (07)
spanning tree using Kruskal's algorithm. Show all steps.
11
Fig.4b
c) What is binary searching? Explain with suitable example. (07)
Page 2 of 4
EC401
UNIT - III
5. a) Write a C function to split a linear linked list into two linear linked (10)
lists on the basis of data. The even numbers are stored in the first
list and odd numbers are stored in the second list. Display the even
and odd lists.
b) Write advantages of doubly linked list over singly linked list. Write a (10)
C function that will insert a given integer value into an ordered
doubly linked list.
6. a) Write a C function for the following using singly linked list. (10)
i) Read a polynomial
ii) Multiply two polynomials
iii) Display a polynomial
b) Give a comparison between linked list and array. (04)
c) Write a C function to delete a node from the front end and insert it at (06)
the end of the list using circular linked list with header node.
UNIT - IV
7. a) Write a C program to represent a queue using circular linked list. (08)
b) Assume a 5 element circular queue. Initially queue is empty. Show (06)
the contents of the queue after each of the following operations.
Insert(Q,10), Insert (Q,20), Delete (Q), Delete (Q), Insert (Q,30),
Delete (Q).
c) Write algorithms for the following operations on a stack implemented (06)
using linked list.
i) Push ii) Pop iii) Show the top value of the stack.
iv) Check whether stack is full v) Check whether stack is empty
UNIT - V
9. a) What is Binary tree? Explain various traversal techniques with (08)
suitable example.
b) Write a C function for the following using a Binary search tree. (06)
i) Insert an element
ii) Largest element in a tree
iii) Total number of elements in a tree.
c) Draw the expression trees for the following (06)
i) a*b+(c/d)-e
ii) a*(b+c)/d-e
iii) a^b^c+c*d*e
Page 3 of 4
EC401
10. a) Consider a binary tree with 8 nodes. The preorder and inorder (04)
traversal of binary tree T yield the following sequence of nodes.
Preorder : ABDEGHCF
Inorder : DBGEHACF
Draw the Binary Tree T.
*************************
Page 4 of 4