Data structures

1. The expression  E+(A+B)*D)-C can be written in reverse polish notation
Step 1: Reverse polish notation is as sames as post fix notation
Ans = EAB+D*+C-

2. the average worst case performance of a quick sort algorithm is
Ans 𝚯(nlogn)

3. The mo of edges in a regular graph of degree d and n vertices is
Ans. nd/2

4.The depth of binary tree is
Ans. log n+1

5.Post fix notation of ((A+B)*C-D-E)ᐁ(F+G)
Hint: convert the options into infix and try to get the question
Ans: AB-C*DE--FG+Aᐁ

6.Merge sort is uses divide and conquer

7. which data structure  allows deleting data elements from front and inserting at rear?
 KERALA PSC
A. Stacks
B. Queue
C. De ques
D. Binary Search Tree
Ans:Queue
Explanation: Queue is line like a  ticket counter . first in first out. delete from front and insertion on other end
On De ques insertion and deletion takes place in both ends
On stacks LIFO

8. Which of the following data structure is linear type ?
 KERALA PSC
A. Strings
B. Lists
C. Queues
D. All of the above

Ans:All of the above

9. Which data structure can be used to efficiently implement Dijkstra's algorithm?

Kerala PSC System analyst Post 2019

A. Double Ended Queue
B. Priority Queue
C. Stack
D. Binary Search Tree

Ans: Priority Queue

Explanation:  Dijkstra's algorithm

To find shortest path.
Main application in computer networks when a message sent from the receiver.
if there is many host in computer networks it finds the destination by using Dijkstra's algorithm



Dijkstra’s Shortest Path Algorithm 

Find shortest path of each node



NODE
SHORTEST PATH
0
0
1
4
2
12
3
19
4
21
5
11
6
9
7
8
8
14



 For node 4 there is 2 way



from node 0 to 4

that is 8+1+2+10=21

another path is 4+8+7+9=28

here shortest path is 21



10. The height of a tree is the length of the largest root to leaf in it.
      The maximum and minimum number of nodes in a binary tree of height 5 is
      To find maximum number of nodes (2h+1-1)

Ans: Here h=5
     ∴ 25+1-1
      26-1=64-1
       =63
    To find minimum number of nodes =h+1

           5+1 =6
         ∴ Maximum and minimum number of nodes are 63,6 



11. A Euler Graph one which
Ans) All vertices are of even degree
12. A graph in which all nodes are of equal degree is known as
Ans) Regular graph













Comments