Difference between revisions of "Algorithms"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(What is an Algorithm)
(Hand tracing algorithms)
 
(3 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
 
=Hand tracing algorithms=
 
=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.
  
<youtube>https://www.youtube.com/watch?v=CwLnL–66tY&list=PLCiOXwirraUCDWr2XWh7Wg69D7q1Jw6ac&t=3s&index=2</youtube>
+
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.
  
https://www.youtube.com/watch?v=CwLnL–66tY&list=PLCiOXwirraUCDWr2XWh7Wg69D7q1Jw6ac&t=3s&index=2
+
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.
 +
 
 +
<youtube>https://www.youtube.com/watch?v=9sTyOwOWjVI</youtube>
 +
 
 +
https://www.youtube.com/watch?v=9sTyOwOWjVI
  
 
=Converting Pseudo code to high level code=
 
=Converting Pseudo code to high level code=
 +
To convert Pseudo code to C#, visit the following page:
 +
 +
[[CSharp to Pseudo Code]]
  
 
<youtube>https://www.youtube.com/watch?v=ZKQijtMqt_I&index=3&list=PLCiOXwirraUCDWr2XWh7Wg69D7q1Jw6ac</youtube>
 
<youtube>https://www.youtube.com/watch?v=ZKQijtMqt_I&index=3&list=PLCiOXwirraUCDWr2XWh7Wg69D7q1Jw6ac</youtube>

Latest revision as of 08:25, 23 August 2023

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