What and how would I use the bubble sort algorithm using C# to find the maximum value in an array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What and how would I use the bubble sort algorithm using C# to find the maximum value in an array?

19th Jan 2021, 6:39 PM
Kanji-50
Kanji-50 - avatar
3 Answers
+ 3
//c++ algorithm. int arr[100]; //input values for ( int i = 0; i < 99 ; i++) for ( int ii = i+1; ii < 100; ii++) if (arr[i] > arr[ii]) swap ( arr[i], arr[ii] ); int max = arr [99]; Then translate this code to C#.
19th Jan 2021, 6:50 PM
Just@bit$mile
Just@bit$mile - avatar
+ 1
To find a minimum or maximum?
19th Jan 2021, 6:40 PM
Just@bit$mile
Just@bit$mile - avatar
0
To find the maximum value and sort the list efficiently.
19th Jan 2021, 6:42 PM
Kanji-50
Kanji-50 - avatar