Topic 1 - Algorithms Flashcards
(22 cards)
Algorithm
Set of instructions that need to be followed and complete a task to solve a problem
Well written algorithm
Individual instructions
What’s included within algorithms ?
Variables, conditionals, repetition, data structures and subprograms
Variable
A storage location identified by a name that can be called back to
Variable example
Data types
Data type examples?
Integer, float, character, boolean and string
Repetition within an algorithm
Looping and iteration
What is a procedure?
Follows instructions but doesn’t return a value
What is a function ?
Follows a set of instructions and passes a value back
Pseudocode
Conveys a clear purpose and detail
Construct
Order of execution of lines
Sequence
Order of line of code
Selection
One of many lines of code that are selected through a decision made by the user
Iteration
The code repeated (While/for)
For loop
Definite loops that have a fixed number of repeats
While loop
Indefinite loop that stops once a condition is met
What should an efficient algorithm include ?
Less lines, smaller file, faster speeds
What are flowcharts ?
A way to plan out an algorithm
What factors are required for an algorithm to be an algorithm ?
Instructions must be able to end and not loop forever and a value must be produced at the end
What are arrays ?
A data structure that contains many values
Decomposition
Breaking down a problem to make it easier to solve
Abstraction
Taking out the most important information to utilize is to solve a problem