sorting Flashcards
bubble sort
simple but inefficient
used for smaller lists but are nearly sorted
o(n^2)
insertion sort
more efficient than a bubble sort as doesnt require mutltiple passes
if it is used for a list which is nearly sorted time complexity goes from o(n^2) to o(n)
merge sort
uses divide an conquer to separate elemts, orders them the merges them together
recursive
more efficient than bubble and sort
it will sort a large list faster
o(nlogn)
requires more memory for merging process
quick sort
uses divide and conquer to solve problem
doesnt require additional memory space
o(n logn)
djikstraa
finds the shortest path between start node and other nodes in a weighted path
a*
alternative to djikstraa because of use of heuristics
focuses only on reaching end noth whereas djikstraa focuses on the lowest cost shortest path between every node