CSc 21200  Exam 2 solution

$25.00

Original Work ?

Download Details:

  • Name: EXAM2.zip
  • Type: zip
  • Size: 160.64 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (2 votes)

Name your header file as LastName(3 to 5 letters)_FirstNameInitial_E2_Q[1,2,3].h
Note: You can only use iostream, cassert, cmath, cstdio, cstdlib, and the given files.
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.