일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- apple intelligence
- Union-Find
- 동작과정
- Content Hugging priority
- Content Compression Resistance priority
- 자료구조
- 동시성프로그래밍
- IOS
- LLM
- 애플인텔리전스
- CICD
- 알고리즘
- ReactiveX
- RxCocoa
- Autolayout
- gitlab
- ai expo
- mvvm
- CI/CD
- 백준
- 클린아키텍처
- RxSwift요약
- swift
- AI
- cleanarchitecture
- 오토레이아웃
- swift알고리즘
- OperationQueue
- gitlabci/cd
- rxswift
- Today
- Total
목록알고리즘 (4)
JosephCha의 개발일지

let firstLineInput = readLine()!.split(separator: " ").map{Int(String($0))!} let secondLineInput = readLine()!.split(separator: " ").map{Int(String($0))!} let limit: Int = firstLineInput.last! let length: Int = secondLineInput.count var result: Int = 0 for i in 0..

let input = readLine()!.split(separator: " ") if input == input.sorted() { print("ascending") } else if input == input.sorted(by: >) { print("descending") } else { print("mixed") } 설명 ascending일 경우는 즉 오름차수로 정렬된 상태 dscending일 경우는 즉 내림차수로 정렬된 상태 나머지는 mixed 참고: https://www.acmicpc.net/problem/2920
선택 정렬 (selection sort) 이란? 다음과 같은 순서를 반복하며 정렬하는 알고리즘 주어진 데이터 중, 최소값을 찾음 해당 최소값을 데이터 맨 앞에 위치한 값과 교체함 맨 앞의 위치를 뺀 나머지 데이터를 동일한 방법으로 반복함 func SelectionSort(unSortedArray: [Int]) -> [Int] { var unSortedArray = unSortedArray for index in 0..
삽입 정렬 (insertion sort) 란 삽입 정렬은 두 번째 인덱스부터 시작 해당 인덱스(key 값) 앞에 있는 데이터(B)부터 비교해서 key 값이 더 작으면, B값을 뒤 인덱스로 복사 이를 key 값이 더 큰 데이터를 만날때까지 반복, 그리고 큰 데이터를 만난 위치 바로 뒤에 key 값을 이동 func insertionSort(unSortedArray: [Int]) -> [Int] { var unSortedArray = unSortedArray for index in 0.. unSortedArray[index2] { let temp = unSortedArray[index2] unSortedArray[index2] = unSortedArray[index2-1] unSortedArray[index2..