
APPENDIX
This appendix contains a number of algorithms which are not included
in the body of the textbook and yet may be required at some time in a
programmer's career.
The first three algorithms are sorting algorithms, viz bubble sort,
insertion sort and selection sort. Then follow five algorithms which
manipulate the elements of an array.
1 Sorting algorithms
1.1 Bubble sort algorithm
This algorithm sorts an integer array into ascending order using a
bubble sort method.
The algorithm, on each pass, compares each pair of adjacent items
in the array. If the pair is out of order they are switched, otherwise they
will remain in the original order ...