# Data Structures with  Dec.07/Jan.08

## Set -B

Note : Answer any FIVE full questions.

1 a. Given the Following declarations:

int x ; doubled; int *p; double *q;

Which of the following expressions are not allowed?

(i) p=&x:*  (ii) p = &d;  (iii) q – &x;  (iv) q = &d  (v) p = x;

/* local definitions */ int x |2] ;– {

{4,5,2},

{ 7, 6, 9}

/* statements*/ fun (x); fun (x4-l);.: return 0;

}

void fun (intr(*p))

{

print f (“ln %d %d %d”, (*p), (*p)[l], *p); return;

}

c.   Briefly explain memory allocation functions.

2 a. Implement  i)Copying one string to another ii) Reversing the given string.

Without using string library functions in ‘C/

b. Write a C program to represent a complex number using structure and add two complex numbers.

3 a Define stack and operations over stack. Implement reversing a string using

stack (array implementation) in C.

b. What is recursion? Explain efficiency of recursion. Write a ‘C’ recursive program to solve tower of Hanoi problem.

4 a. Write a C program to implement multiple stacks using single array.

b. What is a linear queue? What are the applications of linear queue? Implement insert and delete operations.

5 a. Given an ordered linked list whose first node is denoted by ‘start’ and node

isrepresented by ‘key’ as information and iink’ as link field. Write a C program

to implement deleting number of nodes (consecutive) whose ‘key’ values are

greater than or equal to ‘Kmjn’ and less than.

b. Write a C program to implement insertion to the immediate left of the K node in the list.

6 a. Write a C program to implement doubly linked list with following operations:

i) Create ii); Insert.

b.  Implement^ concatenation of two circular singly linked lists List 1 and List 2. Use header nodes to implement the list.

7 a. Implement Binary tree traversals in C:

(i) Inorder   ii) Preorder    iii) Postorder.

b.   What are the applications of binary tree? Implement binary search tree and check for duplicate data,

8. Write short notes on: