Skip to content
Open
Show file tree
Hide file tree
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
Empty file added 2025-06-24.md
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### 선언

- **빈 Dictionary 선언** Int를 Key값으로 받고 String를 Value로 받는 Dictionary 선언하기
- **var dictionaryName: [Int: String] = [:]**
- **var dictionartName: Dictionart<Int, String> = [:]**
- **var dictionartName = Dictionary<Int, String>()**

### 원소 개수
- **dictionaryName.count**

### 원소 추가

- **dictionaryName[Key] = Value** dictionaryName = [Key: Value]
- 해당 Key가 없다면, 추가 (insert)
- 해당 Key가 있다면, Value 덮어쓰기 (update)

- **dictionaryName.updateValue(Value, forKey: Key)**
- 해당 Key가 없다면, 추가하고 nil 리턴 (insert)
- 해당 Key가 있다면, Value 덮어쓰고 덮어쓰기 전 값 리턴 (update)

### Dictionary 초기화

- **dictionaryName = [:]**
10 changes: 7 additions & 3 deletions Docs/컬렉션 타입 (CollectionType)/배열 (Array).md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
---

##### **원소를 제거하는 메서드 (.remove)
- **arrayName배열 안에 22라는 제거한다.
- **arrayName배열 안에 22라는 제거한다. (첫번째로 나오는 22만 지움)
- `arrayName.remove(22)
- **arrayName배열 안에 0번 인덱스에 해당하는 원소를 제거한다.
- `arrayName.remove(at: 0)
Expand Down Expand Up @@ -82,6 +82,10 @@
- **arrayName배열 안의 원소들을 인덱스 순서대로 호출한다.
- `for item in arrayName{}`
- **.enumerated는 원소의 값과 함께 인덱스도 출력하게 해준다. (ex. index: 0: 22)
- `for (index, value) in arrayName.enumerated() {}`
- `for (index, value) in arrayName.enumerated() {}
-
- .enumerated를 사용하지 않고 원소의 값과 인덱스를 출력하는 방법
```let items = ["apple", "banana", "cherry"]

---
for (index, value) in zip(items.indices, items) {
print("index: \(index), value: \(value)")}
46 changes: 46 additions & 0 deletions Docs/컬렉션 타입 (CollectionType)/세트 (Set).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
- **Set는 Array과 유사하지만, Array과 달리 Set에서는 같은 값을 가진 원소를 중복해서 포함할 수 없다.**
- **Set는 순서가 중요하지 않아서 출력할 때 마다 순서가 바뀐다.**
### 선언
- **빈 세트 선언 (Array와 형태가 같기 때문에 명시적으로 Set을 선언해줘여 한다)**
- var setName = Set<DataType>()
- var setName: Set<DataType> = []

### 원소 개수
- **setName.count**

### 원소 추가
- **setName.insert(”a”)**

### 빈 배열로 초기화
- **setName = []**


### Set Operation
- **합집합(.union)**

- **setName.union(anoterSet)** setName과 anotherSet의 원소들을 합친 값
-
- **차집합(.subtracting)**

- **setName.subtracting(anoterSet)** setName에서 anotherSet의 원소들을 뺀 값
- **대칭차집합(.symmetricDifference)**

- **setName.symmetricDifference(anoterSet)** 합집합에서 교집합을 뺀 값
- **교집합(.intersecrion)**

- **setName.intersecrion(anoterSet)** setName과 anotherSet이 공통으로 가지고 있는 값
- **정렬(.sort, .sorted)**

- **setName.sort()** Set을 오름차순으로 정렬
- **setName.sorted()** Set을 정렬하지만 사본을 만들어서 정렬
- **조건(true or false)**

let set1: Set = [”A”, “B”]

let set2 : Set = [”A”, “B”, “C”, “D”]

let set3 : Set = [”D”, “E”, “F”]

- **부분집합(.isSubset)** set1.inSubset(of: set2) = true set1이 set2에 포함되어 있는가
- **모집합(.isSuperset)** set2.isSuperset(of: set1) = true set2가 set1의 모집합인가
- **교집합의 존재유무(.isDisjoint)** set2.isDisjoint(with: set3) = false set2와 set3 사이에 교집합이 존재하지 않다면 true. →교집합 “D”가 존재하기 때문에 false
1 change: 1 addition & 0 deletions 무제 1.canvas
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions 무제 2.canvas
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions 무제.canvas
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}