CISC 235 Midterm: CISC 235 Test 1 Winter 2018

345 views7 pages
9 Jan 2019
Department
Course
Professor

Document Summary

Pencil answers will be marked, but will not be re-marked under any circumstances. The test will be marked out of 50. Behind complexity, there is always simplicity to be revealed. Inside simplicity, there is always complexity to be discovered. Let: [4 marks] determine the classification of, [4 marks] determine the classification of, [2 marks] if possible, determine the classification of. Let stack be a class that implements the stack data structure. Let s be a stack containing integer values. Write an algorithm that will take a positive integer k as a parameter and move the botom k values of the stack to the top. If the stack contains k values, it should not be changed. For example if the stack contains and k = 2, the final result should be. Your algorithm is allowed to create and use other stacks but cannot declare arrays, linked lists or other data structures.