Define REV(X) to mean reverse the elements in the data structure and SWITCH(X) to mean switch the data structure from a stack to a queue or a queue to a stack. What is popped next if it starts as a queue?: PUSH(F), POP(X), PUSH(B), PUSH(J), PUSH(A), PUSH(T), SWITCH(X), PUSH(O), PUSH(P), POP(X), POP(X), POP(X), PUSH(L), PUSH(F), REV(X), PUSH(R), PUSH(B), POP(X), PUSH(V), PUSH(N), PUSH(E), POP(X), PUSH(I), SWITCH(X), POP(X), POP(X), PUSH(U), PUSH(S), POP(X), REV(X), POP(X), POP(X), POP(X), PUSH(Q), POP(X), POP(X), SWITCH(X), PUSH(D), POP(X), POP(X), PUSH(H), PUSH(J), SWITCH(X), PUSH(C), REV(X), PUSH(W), PUSH(G), POP(X)
Make a BST of the word PERIODICTABLE, then delete D, delete T, and delete A. What is the internal path length (sum of depths of every node) of the resulting tree?
Make a heap of the word CARRYON, then delete the top node twice. How many external nodes are in the resulting tree?
In case you forgot anything, here is a website with a review of what we learned: http://www.categories.acsl.org/wiki/index.php?title=Data_Structures
1. J 2. 22 3. 6