Algorithms

An algorithm is a set of instructions that can be followed to complete a desired task. Programmers solve problems using algorithms. Algorithms can be represented using Pseudocode, Flow Charts or simple bullet lists.

4 key Algorithms:


  • Linear search (searching data) - each element in list is searched sequentially until desired data found. This is good because data can be in any random order but also quite inefficient as a lot of data may have to be searched through. 


  • Binary search (searching data) - data set repeatedly divided, value of checked data that is in middle of section, if data value looking for is higher, only top half is searched etc. This is good because not all data needs to be searched, but data does have to be sorted into the correct order.


  • Bubble sort (sorting data) - compares each pair of adjacent items to check if they are in the right order, if not they are swopped. Process repeats. 




  • Insertion sort (sorting data) - takes each piece of data individually and sorts it into the correct position directly. 





For searching Algorithms, the Linear search is probably best for data searches with relatively small amounts of data as there is no need to sort the data. However if there are huge amounts of data a binary searh would be much more efficient. 


Comments

Popular posts from this blog

CPU Fetch-Decode-Execute Cycle

OSI Network Model

Scheduling