Question: Consider the following algorithm where the input is a rooted tree with root r. Step 1: Push r onto the (empty) stack Step 2: While
Step 1: Push r onto the (empty) stack
Step 2: While the stack is not empty
If the entry at the top of the stack is not marked
Then mark it and push its
children-right to left-onto the stack
Else
Pop the vertex at the top of the stack and record its label
What is the output when the algorithm is applied to
(a) The tree in Fig. 12.19?
(b) Any rooted tree?
.png)
4 7 8 9 11 12 13 14 15 16 17
Step by Step Solution
3.50 Rating (163 Votes )
There are 3 Steps involved in it
a 11 12 13 14 5 2 6 7 3 8 9 15 16 1... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
954-M-L-A-L-S (8274).docx
120 KBs Word File
