Paper 1 Flashcards
What is an algorithm?
A sequence of steps that can be followed to complete a task.
What is a computer program?
An implementation (application) of an algorithm.
What is decomposition?
The process of breaking down a complex problem into sub-problems or more manageable chunks, so each sub-problem accomplishes an identifiable task.
* This makes the problem easier to understand.
What is abstraction?
Abstraction is the process of removing unnecessary detail from a problem.
* This SIMPLIFIES the problem
What makes an algorithm efficient?
- Takes less time to execute.
- Less calculations are required for the algorithm to be completed.
How does the linear search algorithm work?
Why is it important to use a meaningful identifier name?
- Describes the role of the variable
- Making the algorithm easier to understand
What are the advantages of using the structured approach/ subroutines?
- Subroutines can be developed seperately
- It is easier to discover errors
- Subroutines can be updated without affecting the overall program
What should the conditions of an algorithm be?
- Preicse
- Well-defined
- Finite
What is pseudocode?
- Informal description
- Intended for human reading and understanding, but understands code
- No standardised (correct) syntax
Flowcharts:
- Symol for start/end of an algorithm- ⬭
- Symbol for a process being carried out- ☐
- Symbol for a decision to be made- ⬦
The linear search algorithm:
- Works by checking each element to see if it matches the target
- This repeats until a match has been found or the whole list of values has been checked
- WHEN PROGRAMMING THIS USE A BOOLEAN VALUE TO KEEP TRACK OF THE VALUE AND IF IT HAS BEEN FOUND/NOT FOUND.
🚩- Not efficient for long lists
The binary search algorithm:
- List must be ordered first to work- extra step. If this is not done, the program is inefficient and won’t work.
- OVERALL, BINARY SEARH IS MORE EFFICIENT THAN LINEAR SEARCH.
Compare the bubble sort and merge sort algorithm.
- Bubble sort is less efficient than merge sort
What is a variable?
- An address in memory
- That is given a name
- That is assigned a value
- That can change whilst the program is running.