Professional Documents
Culture Documents
3. Define Pop
Ans:The pop operation removes an item from the top of the list, and returns this value to the
caller. A pop either reveals previously concealed items, or results in an empty list.
4. Mention any two Applications of Stack
Ans: a)Infix to Postfix Conversion using
Stack
b)Evaluation of Postfix Expression
Viva Questions:
1. What are the notations used in Evaluation of Arithmetic Expressions using prefix and
postfix forms?
Ans:Polish and Reverse Polish notations.
2. Which data structure is needed to convert infix notations to post fix
notations? Ans: stack.
3. What is the result of the given postfix expression ABC *+ where A 1 B 2 C
3? Ans:7.
4. What is the result of 456*+
Ans:34.
5. Define operations on Stack ?
Ans: The basic operation that can be performed on Stack are as follows:
a) PUSH
b) POP
6. Give the formula to find the number of movements in Tower of Hanoi
problem? Ans: x=pow(2,n)-1.
7. How many moves does it take to solve the Tower of Hanoi for 5
disks? Ans:31 moves
Viva Questions:
1. Define Doubly Linked List : Here, here are two references associated with each node, One
of the reference points to the next node and one to the previous node.
Eg. NULL<-1<->2<->3->NULL
2. What type of memory allocation is referred for Linked
lists? Dynamic memory allocation is referred for Linked lists.
3. Mention what is the difference between singly and doubly linked
lists? Ans:A doubly linked list nodes contain three fields:
An integer value and Two links to other nodes one to point to the previous node and
other to point to the next node. Whereas a singly linked list contains points only to the next node.
4. Mention what are the applications that use Linked lists?
Ans:Both queues and stacks are often implemented using linked lists. Other applications are list,
binary tree, skip, unrolled linked list, hash table, etc.
Viva Questions:
1. Explain Graph in C
Ans:A graph is a data structure that consists of the following two components:
1. A finite set of vertices also called as nodes.
2. A finite set of ordered pair of the form (u, v) called as edge. The pair is ordered because (u,
v) is not the same as (v, u) in case of a directed graph(di-graph). The pair of the form (u, v)
indicates that there is an edge from vertex u to vertex v. The edges may contain
weight/value/cost.