In diving competitions, divers receive scores out of ten from seven judges for each dive.
Each dive is also attributed a degree of difficulty which is a number ranging from 1.2 to 3.8 (inclusive) in one-tenth increments.
For example, upon completion of a 2.5 degree difficulty dive, a diver may achieve the following scores: 5.5, 7.5, 5.5, 7.5, 6.5, 5.0, 7.0
These scores are then used to calculate a single final score as follows:
- Bubble Sort is applied to the unordered scores to arrange the sequence from lowest to highest: 5.0, 5.5, 5.5, 6.5, 7.0, 7.5, 7.5
- The two lowest / highest scores are disregarded, leaving exactly three scores: 5.5, 6.5, 7.0
(Note: at most two values from each extremity are disregarded, meaning that some equally low/high values may be retained)
- The remaining three scores are added together: 5.5 + 6.5 + 7.0 = 19
- Finally, the total is multiplied by the degree of difficulty of the dive to arrive at the final dive score: 19 × 2.5 = 47.5
An association of professional diving clubs has decided to move their historic diving competition records from a simple spreadsheet into a more sophisticated electronic database solution. Future diving competition results will be entered directly into the new database. The association wishes the new database to accomodate data from affiliated non-diving groups such as swimming clubs. Furthermore, in an effort to more readily share their data with a variety of external organisations worldwide, the association plans to expose their database to the web via a secure API. Consultants hired to implement an appropriate solution for the diving association have differing views - while some suggest a relational database solution, others recommend an object-oriented one.