CSc 21200 Exam 2
1. Write a function that take an unsorted linked list and return a linked list that is the
“histogram” of the input linked list. You should only have to go through the input once.
Note: (X/Y) – X is the value and Y is the count.
2. Write a class using two stacks of your stack class to simulate a priority queue and their
basic functions. Note: Assume lower values have a higher priority. All but one of the
basic functions should be constant time. Bonus points will be given if ALL basic
functions are constant time.
3. Write a recursive function that reverse a stack. Note: You can only use the basic
functions of the stack to manipulate it and no additional stack.