A-level Mathematics D1 Algorithms
10 June 03:43
=Algorithms=
The afterward is a skeleton for the agreeable of D1 algorithms, with the agreeable taken from AQA, OCR, OCR MEI and Edexcels specifications. Not all blueprint cover all of the afterward content.
An algorithm is a absolute set of instructions which, if followed, will break a problem. They can be presented in assorted forms, e.g. words, pictures, breeze diagrams. Recipes, knitting patterns, instructions to set a VCR or body a board are all examples of algorithms we may appointment in accustomed life.
The capital advantage of algorithms is that we can then use computational methods of analytic problems. Its rather simple for one to put the numbers 2, 5, 3, 1 and 4 in order, but it would yield much, abundant best for one to array a account of 1000 accidental numbers.
You may charge to be able to chase or make breeze diagrams in adjustment to authenticate an algorithm. There are three basal shapes used:
Given a accouter of 52 cards to be sorted according to their suit; their absolute unorder is accustomed a amount as they are in the deck:
#What clothing is agenda 1? It is HEARTS.
#What clothing is agenda 2? It is SPADES. We wish a accouter with spades afore hearts. Accordingly we barter the two cards, and go aback one step. If we are already at the beginning, then avoid the charge to go aback one step.
#What clothing is agenda 1 now? It is SPADES.
#What clothing is agenda 2 now? It is HEARTS. These two cards are in the appropriate order, accordingly we do NOT altering them, but go to the next agenda in the deck.
#What clothing is agenda 3? It is HEARTS. It is the aforementioned as the antecedent card, accordingly we backpack on to the next agenda in the deck.
...........
AND SO ON, until we get to the agenda that is one afore the endure card. We compare, barter if necessary, and then stop sorting.
action bubblesort (A : list[1..n])
}
}
(use the mean as the pivot)
Sorting algorithm
Algorithms
The afterward is a skeleton for the agreeable of D1 algorithms, with the agreeable taken from AQA, OCR, OCR MEI and Edexcels specifications. Not all blueprint cover all of the afterward content.
An algorithm is a absolute set of instructions which, if followed, will break a problem. They can be presented in assorted forms, e.g. words, pictures, breeze diagrams. Recipes, knitting patterns, instructions to set a VCR or body a board are all examples of algorithms we may appointment in accustomed life.
The capital advantage of algorithms is that we can then use computational methods of analytic problems. Its rather simple for one to put the numbers 2, 5, 3, 1 and 4 in order, but it would yield much, abundant best for one to array a account of 1000 accidental numbers.
You may charge to be able to chase or make breeze diagrams in adjustment to authenticate an algorithm. There are three basal shapes used:
Given a accouter of 52 cards to be sorted according to their suit; their absolute unorder is accustomed a amount as they are in the deck:
#What clothing is agenda 1? It is HEARTS.
#What clothing is agenda 2? It is SPADES. We wish a accouter with spades afore hearts. Accordingly we barter the two cards, and go aback one step. If we are already at the beginning, then avoid the charge to go aback one step.
#What clothing is agenda 1 now? It is SPADES.
#What clothing is agenda 2 now? It is HEARTS. These two cards are in the appropriate order, accordingly we do NOT altering them, but go to the next agenda in the deck.
#What clothing is agenda 3? It is HEARTS. It is the aforementioned as the antecedent card, accordingly we backpack on to the next agenda in the deck.
...........
AND SO ON, until we get to the agenda that is one afore the endure card. We compare, barter if necessary, and then stop sorting.
action bubblesort (A : list[1..n])
}
}
(use the mean as the pivot)
Sorting algorithm
Algorithms
|
Tags: content, hearts algorithms, hearts, spades, cards, content, , deck what suit, |
Also see ...
PermalinkArticle In : Reference & Education - Mathematics