Back to Browse

3.5 Sort Stack | Cracking the Coding Interview Solution

402 views
Jun 16, 2022
12:18

Question: Write a program to sort a stack such that the smallest items are on the top. You can use an additional temporary stack, but you may not copy the elements into any other data structure (such as an array). The stack supports the following operations: push, pop, peek, and isEmpty.

Download

1 formats

Video Formats

360pmp420.7 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

3.5 Sort Stack | Cracking the Coding Interview Solution | NatokHD