Please enable JavaScript.
Coggle requires JavaScript to display documents.
REPRESENTING ALGORITHMS (ALGORITHM (An algorithm is a sequence of…
REPRESENTING ALGORITHMS
-
DECOMPOSTITION
DECOMPOSITION means breaking a problem into a number of sub-problems.
This is so that each sub-problem accomplishes an identifiable task - which could be sub-divided.
-
-
SORTING ALGORITHMS
BUBBLE SORT
A bubble sort works by repeatedly going through the list to be sorted comparing each pair of adjacent elements
-
MERGE SORT
This is a two stage sort. in the first stage, the list is successively divided in half, forming two sublists, until each sublist is of length one.
-
-
-
-
-
SEARCHING ALGORITHMS
LINEAR SEARCH ALGORITHMS
A linear search algorithm works by starting at the beginning of the list working through every set of data one by one.
The disadvantages of using this code is:
It takes a lot of time to find a set of data when there is a lot of data.
The advantages of using a linear search is that:
It is a simple and easy algorithm to code. Also the list doesn't have to be ordered
BINARY SEARCH ALGORITHMS
A binary search works by repeatedly dividing in half the portion of the data list that could contain the required data item.
For example, if we had a list and were trying to find 50...
-
Here we would find the midpoint, in this case it is 43. After this we can discard all the lower numbers so you are left with...
-
-
-
-
Here, the middle term is 50 - so we have found the data item
-
-