Gate
Exam
Numerical Ability
Percentage
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
Option
(A) 10,20,15,23,25,35,42,39,30
(B) 15,10,25,23,20,42,35,39,30
(C) 15,20,10,23,25,42,35,39,30
(D) 15,10,23,25,20,35,42,39,30
Read Solution (Total 1)
-
- Correct Answer is (D),
Preorder is Root, left subtree, and right subtree
Postorder is Left, Root and Right. - 8 years agoHelpfull: Yes(0) No(0)
Gate Other Question
Consider an instruction pipeline with five stages without any branch prediction: Fetch Instruction (FI), Decode Instruction (DI), Fetch Operand (FO), Execute Instruction (EI) and Write Operand (WO). The stage delays for FI, DI, FO, EI and WO are 5 ns, 7 ns, 10 ns, 8 ns and 6 ns, respectively. There are intermediate storage buffers after each stage and the delay of each buffer is 1 ns. A program consisting of 12 instructions 1 2 3 12 I , I , I ,......I is executed in this pipelined
processor. Instruction 4 I is the only branch instruction and its branch target is 9 I . If the branch is taken during the execution of this program, the time (in ns) needed to complete the program is
Option
(A) 132
(B) 165
(C) 176
(D) 328
In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400 and the fragment offset value is 300. The position of the datagram, the sequence numbers of the first and the last bytes of the payload, respectively are
Option
(A) Last fragment, 2400 and 2789
(B) First fragment, 2400 and 2759
(C) Last fragment, 2400 and 2759
(D) Middle fragment, 300 and 689