20162314 2017-2018-1 《Program Design & Data Structures》Learning Summary Of The Second Week
Summary of teaching materials
Searching is the process of finding a designated target within a group of items or determining that it doesn’t exist.
An efficient search minimizes the number of comparisons made.
A binary search capitalizes on the fact that the search pool is sorted.
The Comparable interface allows an algorithm to be implemented polymorphically, without regard to a particular class.
A binary search capitalizes on the fact that the search pool is sorted.
A binary search eliminates half of the viable candidates with each comparison.
Sorting is the process of arranging a list of items into a defined order based on some criteria.
The selection sort algorithm sorts a list of values by repeatedly putting a particular value into its final, sorted position.
The insertion sort algorithm sorts a list of values by repetitively inserting a particular value into a subset of the list that has already been sorted.
The bubble sort algorithm sorts a list by repeatedly comparing neighboring elements and swapping them if necessary.
The quick sort algorithm sorts a list by partitioning the list and then recursively sorting the two partitions.
The merge sort algorithm sorts a list by recursively dividing the list in half until each sublist has one element and then merging these sublists into the sorted order.
A binary search has logarithmic complexity, making it very efficient for a large search pool.
The average running time complexity for selection sort, insertion sort, and bubble sort is O(n 2 ).
The key to quick sort is picking a good partition element.
Merge sort has a maximum running time complexity of O(n log n).
Problem and solution in learning materials of teaching.
Which of linear search and binary search is faster ? And why ?
To start with,A binary search capitalizes on the fact that the search pool is sorted.At the same time,a binary search eliminates half of the viable candidates with each comparison.
Therefore,In general, a binary search is more efficient than a linear search because it eliminates many candidates with each comparison.
What is the difference between merge sort and selection sort ? In addition,there are insertion sort, and bubble sort.
Although selection sort, insertion sort, and bubble sort each solve the problem with a different technique, they all do so with approximately the same efficiency.
All three of those algorithms use two loops, one nested within the other, toarrange the elements in order, and the details all lead to an O(n 2 ) running time.
The analysis of merge sort is similar to that of quick sort, except that we are guaranteed that the recursive decomposition for merge sort will always divide the
data in half.Therefore, the effort of merge sort is O(n log n) in the best, worst, and average cases.
Code hosting
Summary of error for last week.
Linear search is always more effective than binary search.The answer should be false, for the situation of "n = 2".
Evaluate for my partner
- Advantage and problem in the blog:
- Concise and comprehensie
- Uncleary to the content
- Mould is amazing
- Advantage and problem in the code:
- Serious writing.
- Wonderful idea
- Too less
Learning situation of partner
- Learning content of partner:
- Algorithm
- Recursion
- HanoiTowers and maze
Anything else that want to say
- It's not easy to persere on utizing English to write a blog.But I'm getting used to doing this because of the benefit.
Academic progress check
Code line number(increasing/accumulative) | Blog number(inc/acc) | studying time(inc/acc) | progress | |
---|---|---|---|---|
target | 5000lines | 30articles | 400hours | |
First week | 180/180 | 1/1 | 20/20 | |
Second week | 2049/2229 | 1/2 | 18/38 | |
Third week | 500/1000 | 3/7 | 22/60 | |
Fourth week | 300/1300 | 2/9 | 30/90 |