Question: Write an Insertion Sort algorithm for integer key values. However, there is a catch. The input is a stack (not an array), and the only
Write an Insertion Sort algorithm for integer key values. However, there is a catch. The input is a stack (not an array), and the only variables that your algorithm may use are a constant number of integers and a constant number of stacks. You cant use arrays or any other data structures. The algorithm should return a stack containing the records in sorted order (with the least value being at the top of the stack). Like regular Insertion Sort, your algorithms worst-case running time should be (n^2).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
