- Q 5 This List Of Integers Is Stored As A Stack S1 With 105 Being Pushed In First A 5 5 3 10 15 45 71 105 1 (22.69 KiB) Viewed 25 times
Q-5: This list of integers is stored as a stack S1 with 105 being pushed in first. A = (5, 5, 3, 10, -15, 45, 71, 105).
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q-5: This list of integers is stored as a stack S1 with 105 being pushed in first. A = (5, 5, 3, 10, -15, 45, 71, 105).
Q-5: This list of integers is stored as a stack S1 with 105 being pushed in first. A = (5, 5, 3, 10, -15, 45, 71, 105). Stack S2 is a new empty stack. Show the result of the following loop. What is the worst case O(*) runtime? int index = 0; index = pop(S1); if(( index= =0) || (index= 1)) { return; } while(!stack is empty(S1)) { if( peek(S1)%index = 0) { push(S2, pop(S1)); push(S1, peek(S2)/index); } else { pop(S1);