62. .ond L. if aleed is iu. Write a fusction at uses stack operatiom to move tie
ID: 3727343 • Letter: 6
Question
62. .ond L. if aleed is iu. Write a fusction at uses stack operatiom to move tie afh diement of the crenting foore tse top where the of the stack nchanged. Ilf ssiela, theow sdrarsderfoe EmmeJFi s holds 115.3,2,4. 11.afteraTolopf33 it will e 115.34, 16.7 alter 1h.ee sasses of selecom ser1. Ta- ie the insert method to insen val at position pin? Wme t algoritars is a lot of steps,act oode. Lon't skp ary skeps-fre euemgle, deer't write Erow the vexcto wrie esaxtly waat needs 3o be doss. Remiembor ta check edge cises remermber iory asagernent o the sun of the dlemeras thet cate before it. For esample.15.2,891 would become a te lis, Driv the rantine stack showing tdhe actieaios seoorh dos wil be puehed as the resslt of 9 What is the osipet of thc folloneieg seqserce of stack openiaions saricnt s s pesh 101:Explanation / Answer
Solution:
The first question is done as per Chegg guidelines, please repost others.
1)
The image is blurry, so if I took an element wrong from the array, please let me know in the comments.
The array is
16 36 60 87 64 62 35 80 54 57 84 69 7 9
a)
The bubble sort:
In bubble sort, each pair of the adjacent element is compared and if they are not in the order they are swapped.
The array after one pass of bubble sort:
16 36 60 64 62 35 80 54 57 84 69 7 9 87
b)
insertion sort:
The array is 16 36 60 87 64 62 35 80 54 57 84 69 7 9
Basically, insertion sort sorts the elements in a sorted order by applying for n-1 passes and at every pass, the size of the sorted list grows.
Pass 1:
16 36 60 87 64 62 35 80 54 57 84 69 7 9
Pass 2:
16 36 60 87 64 62 35 80 54 57 84 69 7 9
Pass 3:
16 36 60 87 64 62 35 80 54 57 84 69 7 9
c)
Selection sort:
The array is 16 36 60 87 64 62 35 80 54 57 84 69 7 9
Basically, selection sort sorts the elements in a sorted order by placing the minimum value number at first place and applying the same n-1 number of times, so the list gets sorted after n-1 steps.
Pass 1:
7 36 60 87 64 62 35 80 54 57 84 69 16 9
Pass 2:
7 9 60 87 64 62 35 80 54 57 84 69 16 36
Pass 3:
7 9 16 87 64 62 35 80 54 57 84 69 60 36
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.