Please enable JavaScript.
Coggle requires JavaScript to display documents.
Algorithms (Insertion sort (sorted and unsorted list, choose one of…
Algorithms
Insertion sort
sorted and unsorted list
choose one of unsorted data items to put in list (put in right place)
repeat until unsorted list is empty
one array and have a pointer to show end of sorted/start of unsorted
large no of element shifts
perf decreases with incr no of elements
Linear search
search through items in order
worst case n iterations
don't need sorted data
may take a long time
not effective with large arrays
Binary search
data organised as a series of decisions
each choice elims a branch (1/2 solutions)
more logical and quicker
have to sort the data first
linear better for smaller arrays
Bubble sort
compares each pair and swaps if necess
sorted if you can go all the way through w/o swapping
takes approx n^2 scans
algorithm not good for large sets
Stacks
pushing data
if stack full report error and stop
increment pointer
push data on to stack
popping data
if stack empty report error and stop
copy data from position indicated by pointer
decrement pointer
data is not actually deleted
Queues
pushing data
if queue full report error and stop
copy data from position indicated by end pointer
increment end pointer
popping data
if queue empty report error and stop
copy data from position ind by end pointer
increment start pointer
data not deleted- just that the bottom moves up