Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- O(n^2) [Quadratic] sorting algorithms:
- -Selection sort:
- >finds optimal value, swaps it to sorted section
- -Insertion sort:
- >traverses the data, checks if sorted, if not, retreats along data shifting along the way to find sorted spot
- O(n log n) [linear-logarithmic] sorting algorithms:
- -Merge sort:
- >splits the list in two, sorts them, then merges them in correct order
- -Quick sort:
- >uses a pivot, usually the median of the data,
- -Heap sort:
- O(n) [linear] sorting algorithm:
- -Radix sort:
- >Dropping values into "buckets" based on their chars/integers. Its worst case is always O(n).
- >Efficiency will be m*n, where m is the number of digits/characters, or the amount of rounds to drop data into the "buckets", and n is the number of data values.
- Comparison-based sort is always no better than O(n log(n)) (linear-logarithmic)
- =week 10 notes=
- Queues:
- -FIFO: item added first or earliest is at the front and will be removed first. Most recent added will be removed last.
- -Additions to software queues must be done at the back/rear.
- -The client can only look at or remove the data at the front.
- -enque (adding to the back/rear of queue)
- -dequeue (removing from the front of a queue)
- Deque:
- -add and remove from both sides
- -doubly linked chain
- Sorted vs. unsorted procedures:
- -unsorted vs sorted inserting/adding:
- >unsorted inserting is O(1)
- >sorted inserting is O(n)
- -delete minimum/maximum:
- >sorted delete minimum: O(1)
- >unsorted delete minimum: O(n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement