501324-3 Fall 2021 Assignment 501324-3 Fall 2021 Assignment Topics: Stack – Queue - Tree Consider that you have a stack S and a queue Q. Draw S and Q after executing the following operations (Op)....

On paper pleases
501324-3 Fall 2021<br>Assignment<br>501324-3 Fall 2021<br>Assignment<br>Topics: Stack – Queue - Tree<br>Consider that you have a stack S and a queue Q. Draw S and Q after executing the<br>following operations (Op).<br>Topics: Stack - Queue - Tree<br>You have to indicate for each operation, the stack or the queue content in addition<br>to the index value of the top (stack) or the front and the rear (queue)<br>8<br>Stack S; Queue Q;<br>int a=3, b-7<br>• Opl:<br>Op2: S.push(a-b);<br>Op3: S.push(b);<br>Op4: a-pop0;<br>Op5: Q.enqueue(a);<br>Op6: S.push(Q.dequeue());<br>Op7: Q.enqueue(b);<br>Op8: Q.enqueue(S.pop() + b);<br>• Op9 Q.enqueue(Q.dequeue());<br>• Op10: Q.enequeue(S.pop();<br>Q.enqueue(a+b);<br>10<br>Question 4:<br>Traverse the given tree using Inorder, Preorder and Postorder traversals.<br>Operation<br>Stack S<br>Queue Q<br>1<br>2<br>Tree (a)<br>• Preorder:<br>• Inorder:<br>• Postorder:<br>5<br>Question 5:<br>2.<br>

Extracted text: 501324-3 Fall 2021 Assignment 501324-3 Fall 2021 Assignment Topics: Stack – Queue - Tree Consider that you have a stack S and a queue Q. Draw S and Q after executing the following operations (Op). Topics: Stack - Queue - Tree You have to indicate for each operation, the stack or the queue content in addition to the index value of the top (stack) or the front and the rear (queue) 8 Stack S; Queue Q; int a=3, b-7 • Opl: Op2: S.push(a-b); Op3: S.push(b); Op4: a-pop0; Op5: Q.enqueue(a); Op6: S.push(Q.dequeue()); Op7: Q.enqueue(b); Op8: Q.enqueue(S.pop() + b); • Op9 Q.enqueue(Q.dequeue()); • Op10: Q.enequeue(S.pop(); Q.enqueue(a+b); 10 Question 4: Traverse the given tree using Inorder, Preorder and Postorder traversals. Operation Stack S Queue Q 1 2 Tree (a) • Preorder: • Inorder: • Postorder: 5 Question 5: 2.

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here