You are on page 1of 2

# Assignment 10:

1. Generate two linked lists and add these to create a new list.
2. How can we reverse a singly linked list?
3. Write a program using linked list to store/solve a given polynomial of degree n, i.e.,
y=a0+a1.x+a2.x^2+...+an.x^n (. represents the product and ^ represents power).

Assignment 11:

## 1. #pragma pack(push,1) makes sense for memory saving purpose. How?

2. A linked list is defined in such a way that each node of it is a queue of fixed size. How complex
this structure will be?
3. The nodes o linked list are generated on the fly whenever required using malloc() function and
deleted using free() function. If only the pointer referring to the node that is being deleted is
changed and the node is not explicitly deleted what problem may occur?

Assignment 12:

1. Generate a priority queue whose each element is having a priority of deletion defined as 4 for
highest and 0 for lowest. An element with highest priority will be deleted first. How will you
implement the values of priority?
2. Generate a restricted queue in which elements to be deleted are restricted according to some
given condition (say, element<15). If the front element does not follow the specified condition, it
is shifted towards rear. What will be the problem with such a queue?

Assignment 13:

1. A bounded queue is defined where a bound on 5 elements from the front is set so that only
these elements can be used for deletion provided they follow a given condition. If no element
follows the condition, the front element is removed by force and next 5 elements are maintained
for the bounds. What is the purpose of such a queue?
2. A queue is being implemented with the help of linked list. Can we delete any element from the
queue as done in linked list? What restriction is to be followed for this queue and how can it be
implemented?
3. A linked stack is defined with each node connected with the next by a pointer. The last node is
called top element. Can the first element of this stack be deleted since this is a linked list? How
van this operation be prevented?

Assignment 14:

1. A singly linked list maintains one pointer whereas the doubly linked list maintains two at a
time. What are the benefits of two pointers here?
2. If a queue is implemented with linked list and the list is used to be circular one, can we say
this a circular queue? How can we differentiate such a circular queue with the circular linked list?
3. Stack is having few exceptional conditions which need to be taken care while implementing it.
Name these conditions with all cases.

Assignment 15:

1. Define the terms: tree, binary tree and search tree. A binary tree is different from the binary
search tree, how will you justify this statement?
2. Linked representation of binary tree is preferred over the array implementation, why?
3. Write the procedure (for each) to visit the binary tree in pre-, post- and in- order manner.
Assignment 16:

1. Can we implement sequential search in parts? For example, the list is divided into n parts and
the key element is searched in these parts individually. Is this scheme beneficial anyway?
2. A binary search tree is being proposed to implement sequential search. Is it possible? Explain.
3. When the sequence is sorted, its binary search tree will be skewed tree (either left or right
skewed). What problem will occur in such a search tree?

Assignment 17:

1. Write the procedure to estimate the height and total nodes of a given binary tree. Use linked
representation to generate the tree.
2. How can a given tree be converted into binary tree? Write the procedure.