We have almost already finished this semester. finally~~. Today, we get the term test two, and so bad ... from assignment, and term test, I found that I have weakness in recursion because I need to revise my code for several times to make correctness. For these two or three weeks, we are studying for sorting and efficiency. Now I will report these two stuffs respectively.
For efficiency, we use it to calculate the steps and will always want to find a way to do something doing the least amount of work. In this class, it is called 'run time' by calculating time (end time - start time). Usually, we use big-Oh, which is a rough estimation on the upper bound of the runtime of an algorithm. Big-Oh are always used to calculate steps in the worst case. For example, if an algorithm has (2n^2 + 2n) steps, it will be less than 4n^2. In this case, it get O(n^2).
For sorting, we have learned about select sort, quick, merge sorting. We pick one of these sorting methods by their efficiency, which spends less time when it runs for one circle.Sorting is arranging a list to make the order for unordered list. For example, selection sort in worst case has [n(n+1)]/2 steps, and we can get O(n^2) in efficiency.
In efficiency and sorting, we want to get the most efficient method, which spends the least time to do function.
No comments:
Post a Comment