Algorithm Assignment 1
Algorithm Assignment 1
2. The collection RAINBOW holds the names of the main colors of the rainbow along with their order
indicator, as follows:
Construct an algorithm using pseudocode to read the data from RAINBOW and store the names of the colors in
a one-dimensional string array, COLOR, and the order indicators in another one-dimensional string array,
ORDER. The matching color and order indicator must have the same index in the COLOR and ORDER arrays.
3. Construct an algorithm using pseudocode to sort the contents of the array ORDER into alphabetical
order. The indexes for the corresponding data in the two parallel arrays must remain the same after sorting.
4. Compare and contrast the bubble sort algorithm and the selection sort algorithm.