Answers for "bubble sort algorithm for list in c++"

0

c++ buble sort

Psuedo code:

Procedure bubble_sort (array , N)
               array – list of items to be sorted
               N – size of array
begin
               swapped = false
               repeat
                             for I = 1 to N-1 
                                              if array[i-1] > array[i] then
                                                           swap array[i-1] and array[i]
                                                           swapped = true
                                              end if
                              end for
                until not swapped
end procedure
Posted by: Guest on November-30-2020
0

bubble sort integers

for (int i = 0; i < n-1; i++) 
            for (int j = 0; j < n-i-1; j++) 
                if (arr[j] > arr[j+1]) 
                { 
                    // swap arr[j+1] and arr[i] 
                    int temp = arr[j]; 
                    arr[j] = arr[j+1]; 
                    arr[j+1] = temp; 
                }
Posted by: Guest on September-01-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language