Review Swift codes (#1150)

* feat(swift): review for chapter_computational_complexity

* feat(swift): review for chapter_data_structure

* feat(swift): review for chapter_array_and_linkedlist

* feat(swift): review for chapter_stack_and_queue

* feat(swift): review for chapter_hashing

* feat(swift): review for chapter_tree

* feat(swift): add codes for heap article

* feat(swift): review for chapter_heap

* feat(swift): review for chapter_graph

* feat(swift): review for chapter_searching

* feat(swift): review for chapter_sorting

* feat(swift): review for chapter_divide_and_conquer

* feat(swift): review for chapter_backtracking

* feat(swift): review for chapter_dynamic_programming

* feat(swift): review for chapter_greedy

* feat(swift): review for utils

* feat(swift): update ci tool

* feat(swift): trailing closure

* feat(swift): array init

* feat(swift): map index
This commit is contained in:
nuomi1
2024-03-20 21:15:39 +08:00
committed by GitHub
parent 300a781fab
commit 7359a7cb4b
55 changed files with 293 additions and 224 deletions

View File

@ -317,7 +317,7 @@ Let's understand this concept of "time growth trend" with an example. Assume the
// Time complexity of algorithm C: constant order
func algorithmC(n: Int) {
for _ in 0 ..< 1000000 {
for _ in 0 ..< 1_000_000 {
print(0)
}
}

View File

@ -101,10 +101,10 @@ In other words, **basic data types provide the "content type" of data, while dat
```swift title=""
// Using various basic data types to initialize arrays
let numbers = Array(repeating: Int(), count: 5)
let decimals = Array(repeating: Double(), count: 5)
let characters = Array(repeating: Character("a"), count: 5)
let bools = Array(repeating: Bool(), count: 5)
let numbers = Array(repeating: 0, count: 5)
let decimals = Array(repeating: 0.0, count: 5)
let characters: [Character] = Array(repeating: "a", count: 5)
let bools = Array(repeating: false, count: 5)
```
=== "JS"