Algorithms Flashcards
What is an algorithm?
An algorithm is a sequence of steps that can be followed to complete a task.
What is decomposition?
Breaking a complex problem into sub problems until each task is manageable, then solving each one individually
What is abstraction?
Removing unnecessary detail from a problem so you are left with important bits, simplifying the task
What is algorithmic thinking?
A logical way of getting from the problem to the solution. Acknowledging if certain bits of code can be reused
What must you always do in pseudocode?
Declare variables
What is efficiency in programming?
How much time is needed to a run a particular algorithm and how much space is needed
Which one is more efficient a bubble sort or a merge sort?
A merge sort
Splits and then merges instead of swapping each pair
Which is more efficient binary search or a linear search?
Binary search
Only when list is ordered
Keeps on cutting of half rather than checking each number
How would you address questions about abstraction?
1-definition
2-important detail
3-unnecessary detail
How do you address questions about decomposition?
1- definition
2- two questions you can think of to sub section
What is considered ‘time’ in programming?
How may number of times memory was accessed
The number of CPU cycles taken to execute the command
is a computer program an algorithm ?
Why use the correct data types?
As each data type is allocated a different amount of memory , using the correct data types makes the code more memory efficient , robust and predictable
What is program flow ?
The order in which statements are executed in a program
- can be controlled used selection and iteration
Write a pseudocode that creates a 6 digit username.
With the first 3 letters being from town first three letters
Then the second 2 digits being their current age
The last digit is the last letter of their surname