My Revision Notes: OCR GCSE: Computer Science by George Rouse

My Revision Notes: OCR GCSE: Computer Science by George Rouse

Author:George Rouse [Rouse, George]
Language: eng
Format: epub
Publisher: Hodder Education
Published: 2017-04-26T16:00:00+00:00


Example

For the list:

Searching for C:

C in lower half of the list so we discard the top half.

C is later in the list than the midpoint so we discard the lower section of the list.

position 2

item C

We have now found the target value at position 2.

Standard sorting algorithms

Bubble sort

A bubble sort is the easiest sort algorithm to understand but it is very inefficient.

• Start at the beginning of the list and compare the first two items.

• If they are in order, fine.

• If not swap them over and record the fact that a swap has been made.

• Now look at the next pair, the second and third items.

• Repeat this procedure until you get to the end of the list.

• If you have made a swap then start again at the beginning.

• Repeat this until you do not make a swap on a complete pass through the list.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.