Open
Conversation
da-in
approved these changes
Nov 8, 2023
Comment on lines
+114
to
+130
Owner
There was a problem hiding this comment.
Suggested change
| ### **장점** | |
| - 알고리즘이 단순하다. | |
| - 대부분의 원소가 이미 정렬되어 있는 경우, 매우 효율적일 수 있다. | |
| - 정렬하고자 하는 배열 안에서 교환하는 방식이므로, 다른 메모리 공간을 필요로 하지 않는다. => 제자리 정렬(in-place sorting) | |
| - 안정 정렬(Stable Sort) 이다. | |
| - 선택정렬과 같은 O(n^2) 알고리즘에 비교해서 상대적으로 빠르다. | |
| ### **단점** | |
| - 최악, 평균일때 시간복잡도가 O(n^2)으로, 비효율적이다. | |
| - 길이가 길어질수록 비효율적이다. | |
| ### **장점** | |
| - 알고리즘이 단순하다. | |
| - 대부분의 원소가 이미 정렬되어 있는 경우, 매우 효율적일 수 있다. | |
| - 정렬하고자 하는 배열 안에서 교환하는 방식이므로, 다른 메모리 공간을 필요로 하지 않는다. => 제자리 정렬(in-place sorting) | |
| - 안정 정렬(Stable Sort) 이다. | |
| - 선택정렬과 같은 O(n^2) 알고리즘에 비교해서 상대적으로 빠르다. | |
| ### **단점** | |
| - 최악, 평균일때 시간복잡도가 O(n^2)으로, 비효율적이다. | |
| - 길이가 길어질수록 비효율적이다. | |
Collaborator
There was a problem hiding this comment.
불필요한 단어나 줄 정리가 조금 필요할 것 같아요
Owner
|
시간복잡도 등의 내용을 위로 올리고, 구현 코드는 문서 맨 마지막에 오는 게 좋을 것 같습니다.🤔 |
da-in
requested changes
Nov 8, 2023
Owner
da-in
left a comment
There was a problem hiding this comment.
- #195 (review)
선택 정렬 리뷰 참고해서 재검토 부탁드립니다.🙇🏻♀️
lalabulla
approved these changes
Nov 9, 2023
Collaborator
There was a problem hiding this comment.
Suggested change
| **최악** 의 경우(역으로 정렬되어 있을 경우) 선택정렬과 마찬가지로, (n-1) + (n-2) + .... + 2 + 1 => n(n-1)/2 즉, O(n^2) 이다. | |
| **최악** 의 경우(역으로 정렬되어 있을 경우) 선택정렬과 마찬가지로, (n-1) + (n-2) + .... + 2 + 1 => n(n-1)/2 이 소요된다. 즉, O(n^2) 이다. |
Collaborator
There was a problem hiding this comment.
Suggested change
| 최선의 경우는 **O(n)** 의 시간복잡도를 갖고, 평균과 최악의 경우 **O(n^2)** 의 시간복잡도를 갖게 된다. | |
| 정리해보면 최선의 경우는 **O(n)** 의 시간복잡도, 평균과 최악의 경우 **O(n^2)** 의 시간복잡도를 갖게 된다. |
Collaborator
There was a problem hiding this comment.
불필요한 단어나 줄 정리가 조금 필요할 것 같아요
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.
Summary
Check List