Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

to Heading 2 Title Subtitle Subtle E mp... Sorting is done from left to right, smallest to largest, namely, after the completing sort, the smallest

to

image text in transcribed

Heading 2 Title Subtitle Subtle E mp... Sorting is done from left to right, smallest to largest, namely, after the completing sort, the smallest number will be on the left and largest number on the right. Selection Sort Find the smallest number. And swap it with first unsorted number. Continue this process until all are sorted Example: 1. Round 1: the smallest number is 5 colored by red, the first unsorted number is 77 colored by blue. Swap 5 and 77. Shade the sorted area by a light color Round2: 5 is already sorted. The next smallest number is 19, and the first unsorted number is 33. Swap 19 and 33 2. 77 | 3 46|85125-166163|39198|47155153|19 5 33 4685 25 77 66 63 39 98 47 55 53 19 5 19 46 85 25 77 66 63 39 98 47 55 53 33 Round 1 Round 2 Bubble Sort From the end, compare two adjacent numbers. If smaller number is on the right side, swap them. Continue this process until the list is completely sorted. Example: Round 1: Compare 19 and 53. 19 is less then swap them. Then compare 19 and 55. Swap them. The compare 19 and 47 and swap them. Continue this until 19 is compared against 5 Since 19 is not less than 5, do not swap them. Now compare 5 and against 25 and swap, then 85, then 46, then 33, then 77, until 5 reaches the first position where it is sorted Round 2: Now the last two numbers 55 and 53, Swap them. Then compare 53 and 47. Do not swap. Compare 47 and 98 and swap them. 1. 2. 3. Round 3: After round 2 is completed, the last two numbers are 98 and 53.continue the process until entire list is sorted. 1177|33|46|851 2515|66|63|39|98 14715515311 Original Data Round 1 Round 2 5 77 33 46 85 25 19 66 63 39 98 47 55 53 115|19 77|33|46|85 25|39|66|63|47198|s3155 Round 35 19 25 7 33 46 65 30 47 6 63 53 98 56

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

=+and non-compete agreements in three to five different countries.

Answered: 1 week ago