Algorithms Flashcards
(67 cards)
Abstraction
Ignore unnecessary information and focus on important facts to reduce complexity
Decomposition
Break a problem down into smaller tasks to make it easier to solve
Reason to use abstraction
Simplifies problems
Less complex
Straightforward to understand problem and create solutions
Focus on fundamental
Reasons to use decomposition
Each individual problem can be separately tested+solved
Enables different people to work on different part of the bigger problem, which can be recombined to produce a full solution
Easier for error detection and debugging
Algorithmic thinking
Final stage, in which logical steps are done to solve the problem
Identify problem components
Logical way to get the solution of a problem
Order of algorithmic thinking
Problem is broken down using decomposition into smaller problems
Then the required data and relevant data is considered using abstraction
What is an algorithm?
A precise set of instructions presented in a logical sequence and when executed will solve a problem
What is automation?
Taking a model and implementing a solution
What is debugging?
Detecting and resolving problems in a program
What is logical reasoning?
Applying rules to solve an issue/problem
Flowchart- start/stop shape
Rounded cornered rectangle
Flowchart- input/output shape
Parallelogram
Flowchart- process/instructions/calculations shape
Rectangle
Flowchart- decisions (if/else) shape
Diamond
Flowchart- subprogram/function shape
Rectangle with two lines going down at each end
What should be in every flowchart?
Arrow connecting boxes and showing direction of program
What is a structure diagram?
Display organisation of a problem in visual format after decomposing the problem
They show subsections to a problem and their link to other subsections
What do structured diagrams show?
Smaller tasks of a larger problem
Advantages of structured diagrams
Easier to code (code solutions for simpler problems)
Each programmer can work on each module individually/independently
Easier to test and debug (done individually)
Individual modules can be updated and fixed without affecting the rest of the program
Reuse sub programs in other programs (in future)
Why keep program easy to maintain?
Easy for others to understand what the code does.
Able to change parts of source code without risk of causing problems elsewhere
How to improve maintainability of code?
Comments can explain what key features do
Indentation to separate different statements in your program
Variables, subprograms(functions), parameters named to what they do (standard naming conventions)
Using subprograms (functions)
What do comments do?
Clear comments enable programmer to understand purpose of each line of code
Important to use when working in a team
What are indentations used for in maintainability?
Improves readability and clearly shows each block of code
Separates different statements in a program
What is the importance of standard naming conventions?
Appropriate variable/parameter/sub programs names, ensure the purpose of said thing is understood and is easier to keep track of