Algorithms

From TRCCompSci - AQA Computer Science
Jump to: navigation, search

What is an Algorithm

An algorithm is a set of instructions designed to perform a specific task. They would normally be written in pseudocode, because they are designed for human use and understanding so they should never be written in a specific programming language. That would make it a program and not an algorithm.

Part of the analysis and design phase of a project is to specify the algorithms required. The implementation stage of a project will convert the pseudocode into the programming language of choice.

Analysis and design of algorithms

https://www.youtube.com/watch?v=L_PrAWzUp3M&list=PLCiOXwirraUCDWr2XWh7Wg69D7q1Jw6ac&t=2s&index=1

Hand tracing algorithms

One of the key skills required for Computer Science is the ability to hand trace an algorithm. This is essentially running the algorithm on paper to determine the output generated and the steps taken.

A good approach would be to create a table with a column for each variable used in the algorithm. You could then go through the algorithm line by line, and record any changes to the variables but also the variables entered into your table would represent their current values.

You could also have a final column for any output generated.

Tracing the algorithm will often involve repetition/ iteration (ie loops), in this case you will simply follow the path through the loop until it terminates.

https://www.youtube.com/watch?v=9sTyOwOWjVI

Converting Pseudo code to high level code

To convert Pseudo code to C#, visit the following page:

CSharp to Pseudo Code

https://www.youtube.com/watch?v=ZKQijtMqt_I&index=3&list=PLCiOXwirraUCDWr2XWh7Wg69D7q1Jw6ac

Algorithm Testing and Feedback

https://www.youtube.com/watch?v=OUdTc1Wzh-k&list=PLCiOXwirraUCDWr2XWh7Wg69D7q1Jw6ac&index=4