Sorting
and Efficiency
During these weeks, sorting becomes one of the most
significant parts that we focus on after learning the recursion. It is
basically an idea that rearranges the elements which are disorder and
unorganized in a sequence back into some sorts of orders by repeatedly
organizing, for instance, a sequence with 2, 1, 3, 5, 4, can be rearranged to
the order that is from the smallest elements to the biggest elements, which is
1, 2, 3, 4, 5. By using the methods of
sorting, it would be contribute to saving times, for we can follow the order we
want to design a program. This makes me
remember the idea of bubble sort that our CSC108 teacher taught us.
There are many sorting methods that have been
developed for sorting the sequences back in order. During the class times, we
have learned three types of different ways relating to sorting, which are the
selection sorting, the quick sorting and mega sorting. No matter how it varies
its ‘name’, the significant parts is the efficiency, to use the least times to
do the most works, this leads us to a part that we needs to distinguish the
worst, average, and best cases of those sorting methods, and I believe this is
the most challenged parts that barriers me.
To give an example, selection sorting uses a recursive algorithm. In
average case, it needs to take ‘nlog(n)’ times to finish the works if the list
is set up by randomly, however, if the list has already a sorted list, then, it
needs to take twice the times to finish to work. To be frank, it is a tough
part when I was learning in class.
Also, the lab goes much more challenging than
the past, I remembered that there is a lab handout that my classmates and I spent
the entire class period to solve, but instead, we met a tough barrier in the
first question that needed us to arrange them in ‘inorder’ and could not get
any meaningful progress. That was a frustration. But I believe this is the
meaning of the lab that required us to put hundred percent attentions towards
the questions and figure them out in order to improve our skills.
没有评论:
发表评论