Mapa mental
Algorithms
Conteúdo do mapa
Algorithms
An algorithm is a set of instructions that describes how to get something done. Algorithms can be designed using pseudocode and flow charts. They are written using statements and expressions.
Sort
- Bubble
- This is where you take the first two numbers and compare them. If the first is bigger, they are swapped. You then move onto 2 and 3, 3 and 4 ect. When you finish, you repeat again.
- Pros
- Easy to code and quickly use for very short lists
- Cons
- Very slow for longer lists
- Pros
- This is where you take the first two numbers and compare them. If the first is bigger, they are swapped. You then move onto 2 and 3, 3 and 4 ect. When you finish, you repeat again.
- Insertion
- This is where you start off with a sorted list of one. This is then increased to by one. You then look at the last item compared with the second last item, and swap if needed. This is done with the new addition until it is no longer swapped. When you move on and increase the sorted list by one again.
- Pros
- Fairly easy to code
- Cons
- Not as fast as Merge sort to run
- Pros
- This is where you start off with a sorted list of one. This is then increased to by one. You then look at the last item compared with the second last item, and swap if needed. This is done with the new addition until it is no longer swapped. When you move on and increase the sorted list by one again.
- Merge
- This is where you separate the list into single numbers. Then merge them back together two at a time, sorting as you go.
- Pros
- Consistently fast for longer lists
- Cons
- Very difficult to code
- Uses more memory as it has to make lots of lists
- Pros
- This is where you separate the list into single numbers. Then merge them back together two at a time, sorting as you go.
- Bubble
Search
- Binary
- This is where you compare the search to the midpoint of the list. If the search is higher than the midpoint, you discard the first half. If it is lower, you discard the second half. If it is equal, you have found it. You then repeat this until it is found, or the remaining list is only 1 number and not the search, in which case, it was not found.
- Pros
- Faster than Linear search
- Cons
- Harder to code
- Has to be ordered
- Pros
- This is where you compare the search to the midpoint of the list. If the search is higher than the midpoint, you discard the first half. If it is lower, you discard the second half. If it is equal, you have found it. You then repeat this until it is found, or the remaining list is only 1 number and not the search, in which case, it was not found.
- Linear
- In this you go through every item in the list and check to see if it is the search. If you get to the end of the list, it is not found.
- Pros
- Easy to code
- Doesn't need to be ordered
- Can check for duplicates
- Cons
- Slow for larger lists
- Pros
- In this you go through every item in the list and check to see if it is the search. If you get to the end of the list, it is not found.
- Binary
Informações
- Descrição
- Mapa Mental sobre Algorithms, criado por Liam Brown em 03-02-2017.
- Criado por
- Liam Brown
- Visualizações
- 1
- Avaliação