Open
Conversation
直接計算版本
This reverts commit b6ca15e.
method1跟上個版本一樣直接計算,method2為上課所說的利用遞迴方式計算
M1是利用quick_sort_median求中位數,而M2是利用quick_sort_median1求中位數,差別在求n為偶數時,M1是在 function 裡從大於第n/2大的數中找第n/2+1大的數字,而M2則是直接在main裡面全部從x[0]到x[N-1]在重新跑過一遍找第n/2+1大的數字,但後來發現兩個會一樣快,是因為M2在前n/2項不會做更動,所以其實就跟M1在找第n/2+1大的數做的事情是一樣的,四分位數就直接利用 M1 去搜尋
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.