Lowest price ever! Learn Generative AI for 48% less!
Get my discount
+ 1

Show an algorithm to place the set (6,2,1,9) into descending order using a flow chart and trace tables using diagrams or example

I want to see how the program works especially the flow chart plus the algorithms as well from the start to stop

12th Apr 2021, 8:06 AM
Dalitso Saviel Chilomo
Dalitso Saviel Chilomo - avatar
11 Answers
+ 4
To quote my former computer science professor, the only good thing about bubble sort is it's name. It's a very slow algorithm although it's conceptually easy to understand So if you're working with a very large dataset it can run painfully slow However, with a small dataset and with the faster CPUs' these days I guess the difference isn't that noticeable Try quicksort. At least it can perform much faster unless the dataset is sorted in reverse order already
14th Apr 2021, 5:48 AM
Macross-Plus
Macross-Plus - avatar
12th Apr 2021, 9:37 AM
ChaoticDawg
ChaoticDawg - avatar
0
look up "bubble sort"
12th Apr 2021, 8:27 AM
Slick
Slick - avatar
0
Algorithm is the step by step to giving task
13th Apr 2021, 1:16 PM
Hajarat Olamide
Hajarat Olamide - avatar
0
Use BUBBLE SORT : If (b>a){ temp=a; a=b; b=temp;}
12th May 2021, 11:46 AM
Sanjay Kamath
Sanjay Kamath - avatar
0
1/2 algorithm (IDK what the technical name is): 1.Case Even - divide successfully and apply bubble sort after each iteration. 2.Case Odd - The middle value is the median, and, using that as the Pivot, do as in step 1 Bubble Sort : temp = a a = b b = temp
9th Feb 2023, 3:07 AM
Sanjay Kamath
Sanjay Kamath - avatar
0
ww
9th Feb 2023, 10:02 AM
Ethan Klein
Ethan Klein - avatar
0
Certainly! Here's an algorithm to sort the set (6, 2, 1, 9) in descending order: 1. Start 2. Initialize the set (6, 2, 1, 9) 3. Compare the first element with the second element: If the first element is smaller than the second element, swap them 4. Compare the second element with the third element: If the second element is smaller than the third element, swap them 5. Compare the third element with the fourth element: If the third element is smaller than the fourth element, swap them 6. Repeat steps 3 to 5 until all elements are in descending order 7. End https://www.myfedloan.us/
30th Jun 2023, 8:58 AM
Andrea
0
Certainly! Below is a simple algorithm for sorting the set (6, 2, 1, 9) into descending order using a flowchart and trace tables. Please note that the algorithm uses a basic sorting technique called "Bubble Sort." Algorithm: Start Initialize the set: (6, 2, 1, 9) Set a flag to true While the flag is true: Set the flag to false For each pair of adjacent elements in the set: If the left element is less than the right element: Swap the elements Set the flag to true https://techgamingworld.com/is-ddr5-ram-worth-it/
8th Jan 2024, 10:38 AM
smith
- 1
Start and stop by flow chart
13th Apr 2021, 1:15 PM
Hajarat Olamide
Hajarat Olamide - avatar
- 1
#using bubble sort li=list({6,2,1,9})#we have to first type cast it to a list as set doenot has fixed index since it follows hashing. for i in range(len(li)): for j in range(len(li)): if(li[i]>li[j]): temp=li[i] li[i]=li[j] li[j]=temp print(li)
7th Dec 2021, 3:45 PM
Chandu
Chandu - avatar