Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Algorithm] 선택 정렬 #195

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CS Deep Dive/Algorithm/선택 정렬(Selection Sort).md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 위에 백문이 불여일견! ~자 지워주시면 감사드립니당👍🏻

![image](https://raw.githubusercontent.com/GimunLee/tech-refrigerator/master/Algorithm/resources/selection-sort-001.gif)

### **예제**
| 패스 | 테이블 | 최솟값 |
|---|---|---|
|0|[9,1,6,8,4,0]|0|
|1|[0,**1,6,8,4,9**]|1|
|2|[0,1,**6,8,4,9**]|4|
|3|[0,1,4,**8,6,9**]|6|
|4|[0,1,4,6,**8,9**]|8|


### **시간 복잡도**

데이터의 개수가 n개라고 했을 때,
Expand Down Expand Up @@ -104,4 +114,16 @@ public class Selection_Sort {

}
```
**[python]**
```python
def selectionSort(x):
length = len(x)
for i in range(length-1):
indexMin = i
for j in range(i+1, length):
if x[indexMin] > x[j]:
indexMin = j
x[i], x[indexMin] = x[indexMin], x[i]
return x
```