Question: 4 . a For the Set abstract data type, what is the ) complexity to add an element and the ) complexity to remove an
a
For the "Set" abstract data type, what is the complexity to add an element and the complexity to remove an element? Explain your answers.
marks
b
You are given four numbers and : They are added in this order into a stack. Then you remove all four of them from the stack. You then take the same four numbers in the original order and add them to a queue. Then you remove all four of them from the queue. Give one example of four numbers ie with actual values where the two ordered sequences the one removed from the stack and the one removed from the queue give the same values.
marks
c
Consider the directed graph shown below:
i State whether is nonconnected, weakly connected, or strongly connected. Explain your answer.
marks
ii How many nodes of have the same indegree and outdegree? Explain your answer.
marks
iii. What is the density of Explain your answer.
marks
iv Write down the order in which the nodes are visited during depthfirst traversal, starting at node Include the symbol uarr wherever the traversal is forced to back up to a previous node. You can assume that adjacent nodes are selected in increasing order of their value.
marks
d
This question is about the
This question is about the
i What is the sequence of nodes visited by the inorder traversal?
marks
ii How many values of are there in the array for the "parent vector" representation of this tree?
marks
iii. Give a tree with a postorder traversal sequence of nodes that is the same as the sequence you have from part i
marks
Total marks
End of Paper
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
