Clive W. Humphris

**DATA STRUCTURES: Data Sorting. **

A number of methods are used in the process of sorting data. Here we introduce one such technique, the 'bubble sort' where the sorted values move to the top or bottom of the sorted array, depending on the ascending or descending selection.

The time taken to complete the sort depends on how the original data is arranged and the number of array interchanges to be made. The data to be sorted could originate from a list of data items (these could be names) in a disk file where to speed up the process it's copied into an array. An array is a group of RAM locations that the central processor operates on. Once sorted the data can then be copied back to the original file.

The process is as follows. Compare each consecutive pair of data items, if the value of position(n) in the array is greater or less than the position(n + 1), (depending on the ascending or descending selection) then exchange that pair. Repeat for the next pair and so on, looping back to the beginning until the sort is completed.

It's not possible to show all the intermediate sorting as the number of exchanges increases significantly for larger numbers of items in the array. If you follow through the first few exchanges you will quickly get a feel of how it works.

- Table of Contents
- Interactive eTextbooks
- Accounting Tools
- Financial Accounts
- Ratio Analysis
- Productivity
- Personal Finance
- Number Systems
- Number Conversion
- Number Types
- Roots
- Percentages
- Ratios
- Fractions
- Laws
- Algebra 0
- Algebra 1
- Algebra 2
- Mathematical Rules
- Powers and Indices
- Simplifying
- Linear Equations
- Graphing
- Data Analysis
- Computer Hardware
- Data Structures
- Data Files
- Computer Systems
- Data Handling
- System Development
- Computer Programming
- Binary Numbers
- Binary Arithmetic