Inha university in tashkent



Download 21,07 Kb.
bet1/2
Sana29.12.2021
Hajmi21,07 Kb.
#83163
  1   2
Bog'liq
DS Assignment 2- Fall 2020 (1)


INHA UNIVERSITY IN TASHKENT

School of Computers and Information Engineering



Group:__________ Fall semester 2020

ID _________

Name ___________

Data Structures (SOC2010)

Submission Deadline: 21 /10/ 2020 (23:00 Hr.)

Problems based on Sorting



NOTE: [Submissions not conforming to the given format will not be evaluated]

1. You are required to solve (handwritten) all the questions.



2. Copying of solution is strictly prohibited. In case it is found, then zero marks will be awarded.

3. Late submissions and email-submissions are not accepted.



Questions

  1. Apply selection sort on the following sequence to arrange the numbers in ascending order. Also comment on its running time.

9 7 5 3








  1. Bubble sort is used to sort the series. Each pass (iteration) of bubble sort will work as follows:

Take an array of numbers " 5 1 4 2 8", after first pass the sequence will be “1 4 2 5 8

Explanation as follows:

Sequence of First Pass can be found as follows

( 6 1 4 2 9 ) → ( 1 6 4 2 9 ), compares the first two elements, and swaps since 5 > 1.

( 1 6 4 2 9 ) → ( 1 4 6 2 9 ), Swap since 5 > 4

( 1 4 6 2 9 ) → ( 1 4 2 6 9 ), Swap since 5 > 2



( 1 4 2 6 9 ) → ( 1 4 2 6 9 ), Now, since these elements are already in order (8 > 5).
Apply Bubble sort on the following sequence to sort and write only the state of an array after each pass



Download 21,07 Kb.

Do'stlaringiz bilan baham:
  1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish