CST 370: Week 5
This week we learned about the quicksort algorithm, binary tree traversal, and decrease and conquer algorithms. The quicksort algorithm uses the divide and conquer approach like merge sort, but partitions based on a particular value referred to as the pivot. The pivot is typically the first element within a given array, but sometimes we apply the median of three rule instead, which involves comparing and sorting the order of the first, middle, and last elements with the array and selecting the middle one as the pivot. As for binary tree traversal, we learned the three order variations using for moving through a tree (preorder, inorder, and postorder) and how to determine a tree's height (the length of the longest path from the root to the leaf node in the tree). In terms of decrease and conquer, the technique is based on the idea that smaller problems are solved more easily and we learned there are three variations: decrease by a constant, decrease by a constant factor, and variable size decrease. We also learned how to apply these variations in techniques such as binary search, which searches for a value within an array but checking the array's middle value and deciding whether or not we need to look further in the half before that value or after it, and topological sorting, which defines an order of dependency for vertices within a directed acyclic graph, or DAG.
Comments
Post a Comment