Skip to main content

Posts

Sorting Operations in Design Analysis and Algorithm

/* Implementing  sorting in a C Program  * Written by: Riddhi Lalakiya.   */ Sorting Algorithms in C 1.BubbleSort : 1. Algorithm : begin BubbleSort(list)    for all elements of list       if list[i] > list[i+1]          swap(list[i], list[i+1])       end if    end for        return list     end BubbleSort 2. Pseudocode : procedure bubbleSort( list : array of items )    loop = list.count;        for i = 0 to loop-1 do:       swapped = false       for j = 0 to loop-1 do:                 /* compare the adjacent elements */    ...