some of the algorithms use more cpu cycles and as such have bad asymptotic values others chew on more memory and other computing resources as they sort number of values another consideration is how sorting algorithms lend themselves to being expressed recursively or iteratively or both there are algorithms that use comparison as the basis for sorting elements an example of this is the bubble sort algorithm examples of non-comparison sorting algorithm are the buck sort and pigeonhole sort bubble sort the idea behind bubble sort algorithm is very simple given an unordered listwe compare adjacent elements in the listeach timeputting in the right order of magnitudeonly two elements the algorithm hinges on swap procedure take list with only two elementsto sort this listsimply swap them into the right position with occupying index and occupying index to effectively swap these elementswe need to have temporary storage area