CSc 21200 Exam 2

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (3 votes)

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.
Input: H→5→5→8→4→4→5→5→1→6→3→T
Output: H→(1/1)→(3/1)→(4/2)→(5/4)→(6/1)→(8/1)→T
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.