Saturday, November 8, 2014

Data Structures - Unit 2

1. What is the need for the header? 
Header of the linked list is the first element in the list and it stores the number of elements in the list. It points to the first data element of the list.

2. List three examples that uses linked list? 
• Polynomial ADT
• Radix sort
• Multi lists

3. Give some examples for linear data structures? 
• Stack
• Queue

4. What is a stack?
Stack is a data structure in which both insertion and deletion occur at one end only. Stack is maintained with a single pointer to the top of the list of elements. The other name of stack is Last-in -First-out list.

5. Write postfix from of the expression –A+B-C+D?
A-B+C-D+


6. How do you test for an empty queue? 
To test for an empty queue, we have to check whether READ=HEAD where REAR is a pointer pointing to the last node in a queue and HEAD is a pointer that pointer to the dummy header. In the case of array implementation of queue, the condition to be checked for an empty queue is READ<FRONT.

7.What are the postfix and prefix forms of the expression? 
A+B*(C-D)/(P-R)
Postfix form: ABCD-*PR-/+
Prefix form: +A/*B-CD-PR

8. Explain the usage of stack in recursive algorithm implementation? 
In recursive algorithms, stack data structures is used to store the return address when a recursive call is Encountered and also to store the values of all the parameters essential to the current state of the procedure.

9. Write down the operations that can be done with queue data structure? 
Queue is a first -in -first out list. The operations that can be done with queue are addition and deletion.

10. What is a circular queue? 
The queue, which wraps around upon reaching the end of the array is called as circular queue. 

No comments:

Post a Comment