Unit 6 - Algorithms✔️ Flashcards
what are algorithms?
a set of instructions for solving a problem or completing a task
what does abstraction mean in relation to algorithms?
abstraction - involves removing unnecessary detail from a problem so that you can focus on the essential components
what is decomposition in relation to algorithms?
decomposition involves breaking down a large problem into small sub-problems - then the sub problems can be broken down further until each small task is manageable
advantages of decompostion?
-problem becomes easier to solve when it consists of a number of small subtracts or modules
-some modules can be reusable in other programs saving development time
why is a structure diagram used?
used to show how a problem is broken down into sub sections
define algorithm thinking?
an approach to solving problems by the use of algorithms
why might a linear search be used?
if the list to be searched is not sorted it is not possible to do a binary search
define how a linear search works?
each item in the list is checked against the search item in order
define how a binary search works?
the middle item is checked first if the item searched for is greater then it - the items to the left will be discarded and a binary search will be carried out on the right side by repeating the process of splitting the middle item and discarding the side which does not contain the desired item
why might a binary search not always work?
only works on a sorted list
4 examples of data that needs to be sorted?
-directories
-house numbers
-library books
-stock in a warehouse
why are computers more efficient with a sorted list?
they can use a binary search which is far more efficient then a linear search
name three algorithms which can be used to sort lists of data?
-bubble sort
-insertion sort
-merge sort
which algorithm is generally the most efficient?
merge sort is generally faster to sort lists
features of an insertion sort?
-algorithm sorts one data item at a time