8000 Merge pull request #183 from chris-pilcher/AVL-tree-migration · adithyabhat/swift-algorithm-club@7cf8985 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7cf8985

Browse files
authored
Merge pull request kodecocodes#183 from chris-pilcher/AVL-tree-migration
Migrating AVL tree to Swift 3
2 parents 116fb5d + cd9c824 commit 7cf8985

File tree

9 files changed

+193
-195
lines changed

9 files changed

+193
-195
lines changed

.travis.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
language: objective-c
2-
osx_image: xcode7.3
3-
sudo: false
2+
osx_image: xcode8
3+
# sudo: false
44

55
install:
66

7-
- ./install_swiftlint.sh
7+
# - ./install_swiftlint.sh
88

99
script:
1010

11-
- xctool test -project ./All-Pairs\ Shortest\ Paths/APSP/APSP.xcodeproj -scheme APSPTests
12-
- xctool test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests
13-
- xctool test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests
14-
- xctool test -project ./Binary\ Search/Tests/Tests.xcodeproj -scheme Tests
15-
- xctool test -project ./Binary\ Search\ Tree/Solution\ 1/Tests/Tests.xcodeproj -scheme Tests
16-
- xctool test -project ./Bloom\ Filter/Tests/Tests.xcodeproj -scheme Tests
17-
- xctool test -project ./Bounded\ Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests
18-
- xctool test -project ./Breadth-First\ Search/Tests/Tests.xcodeproj -scheme Tests
19-
- xctool test -project ./Bucket\ Sort/Tests/Tests.xcodeproj -scheme Tests
20-
- xctool test -project ./B-Tree/Tests/Tests.xcodeproj -scheme Tests
21-
- xctool test -project ./Counting\ Sort/Tests/Tests.xcodeproj -scheme Tests
22-
- xctool test -project ./Depth-First\ Search/Tests/Tests.xcodeproj -scheme Tests
23-
- xctool test -project ./Graph/Graph.xcodeproj -scheme GraphTests
24-
- xctool test -project ./Heap/Tests/Tests.xcodeproj -scheme Tests
25-
- xctool test -project ./Heap\ Sort/Tests/Tests.xcodeproj -scheme Tests
26-
- xctool test -project ./Insertion\ Sort/Tests/Tests.xcodeproj -scheme Tests
27-
- xctool test -project ./K-Means/Tests/Tests.xcodeproj -scheme Tests
28-
- xctool test -project ./Linked\ List/Tests/Tests.xcodeproj -scheme Tests
29-
- xctool test -project ./Longest\ Common\ Subsequence/Tests/Tests.xcodeproj -scheme Tests
30-
- xctool test -project ./Minimum\ Spanning\ Tree\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests
31-
- xctool test -project ./Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests
32-
- xctool test -project ./Queue/Tests/Tests.xcodeproj -scheme Tests
33-
- xctool test -project ./Quicksort/Tests/Tests.xcodeproj -scheme Tests
34-
- xctool test -project ./Run-Length\ Encoding/Tests/Tests.xcodeproj -scheme Tests
35-
- xctool test -project ./Select\ Minimum\ Maximum/Tests/Tests.xcodeproj -scheme Tests
36-
- xctool test -project ./Selection\ Sort/Tests/Tests.xcodeproj -scheme Tests
37-
- xctool test -project ./Shell\ Sort/Tests/Tests.xcodeproj -scheme Tests
38-
- xctool test -project ./Shortest\ Path\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests
39-
- xctool test -project ./Single-Source\ Shortest\ Paths\ \(Weighted\)/SSSP.xcodeproj -scheme SSSPTests
40-
- xctool test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests
41-
- xctool test -project ./Topological\ Sort/Tests/Tests.xcodeproj -scheme Tests
11+
# - xcodebuild test -project ./All-Pairs\ Shortest\ Paths/APSP/APSP.xcodeproj -scheme APSPTests
12+
# - xcodebuild test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests
13+
- xcodebuild test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests
14+
# - xcodebuild test -project ./Binary\ Search/Tests/Tests.xcodeproj -scheme Tests
15+
# - xcodebuild test -project ./Binary\ Search\ Tree/Solution\ 1/Tests/Tests.xcodeproj -scheme Tests
16+
# - xcodebuild test -project ./Bloom\ Filter/Tests/Tests.xcodeproj -scheme Tests
17+
# - xcodebuild test -project ./Bounded\ Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests
18+
# - xcodebuild test -project ./Breadth-First\ Search/Tests/Tests.xcodeproj -scheme Tests
19+
# - xcodebuild test -project ./Bucket\ Sort/Tests/Tests.xcodeproj -scheme Tests
20+
# - xcodebuild test -project ./B-Tree/Tests/Tests.xcodeproj -scheme Tests
21+
# - xcodebuild test -project ./Counting\ Sort/Tests/Tests.xcodeproj -scheme Tests
22+
# - xcodebuild test -project ./Depth-First\ Search/Tests/Tests.xcodeproj -scheme Tests
23+
# - xcodebuild test -project ./Graph/Graph.xcodeproj -scheme GraphTests
24+
# - xcodebuild test -project ./Heap/Tests/Tests.xcodeproj -scheme Tests
25+
# - xcodebuild test -project ./Heap\ Sort/Tests/Tests.xcodeproj -scheme Tests
26+
# - xcodebuild test -project ./Insertion\ Sort/Tests/Tests.xcodeproj -scheme Tests
27+
# - xcodebuild test -project ./K-Means/Tests/Tests.xcodeproj -scheme Tests
28+
# - xcodebuild test -project ./Linked\ List/Tests/Tests.xcodeproj -scheme Tests
29+
# - xcodebuild test -project ./Longest\ Common\ Subsequence/Tests/Tests.xcodeproj -scheme Tests
30+
# - xcodebuild test -project ./Minimum\ Spanning\ Tree\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests
31+
# - xcodebuild test -project ./Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests
32+
# - xcodebuild test -project ./Queue/Tests/Tests.xcodeproj -scheme Tests
33+
# - xcodebuild test -project ./Quicksort/Tests/Tests.xcodeproj -scheme Tests
34+
# - xcodebuild test -project ./Run-Length\ Encoding/Tests/Tests.xcodeproj -scheme Tests
35+
# - xcodebuild test -project ./Select\ Minimum\ Maximum/Tests/Tests.xcodeproj -scheme Tests
36+
# - xcodebuild test -project ./Selection\ Sort/Tests/Tests.xcodeproj -scheme Tests
37+
# - xcodebuild test -project ./Shell\ Sort/Tests/Tests.xcodeproj -scheme Tests
38+
# - xcodebuild test -project ./Shortest\ Path\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests
39+
# - xcodebuild test -project ./Single-Source\ Shortest\ Paths\ \(Weighted\)/SSSP.xcodeproj -scheme SSSPTests
40+
# - xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests
41+
# - xcodebuild test -project ./Topological\ Sort/Tests/Tests.xcodeproj -scheme Tests

AVL Tree/AVLTree.playground/Contents.swift

Lines changed: 11 additions & 11 deletions
< 6D47 td data-grid-cell-id="diff-455b9eb75c65cafe61dbaa9bf8c3fae114f9e310731ec06fa7d55f337fb877aa-5-5-1" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionNum-bgColor, var(--diffBlob-addition-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">5
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22

33
let tree = AVLTree<Int, String>()
44

5-
tree.insert(5, "five")
+
tree.insert(key: 5, payload: "five")
66
print(tree)
77

8-
tree.insert(4, "four")
8+
tree.insert(key: 4, payload: "four")
99
print(tree)
1010

11-
tree.insert(3, "three")
11+
tree.insert(key: 3, payload: "three")
1212
print(tree)
1313

14-
tree.insert(2, "two")
14+
tree.insert(key: 2, payload: "two")
1515
print(tree)
1616

17-
tree.insert(1, "one")
17+
tree.insert(key: 1, payload: "one")
1818
print(tree)
1919
print(tree.debugDescription)
2020

21-
let node = tree.search(2) // "two"
21+
let node = tree.search(input: 2) // "two"
2222

23-
tree.delete(5)
24-
tree.delete(2)
25-
tree.delete(1)
26-
tree.delete(4)
27-
tree.delete(3)
23+
tree.delete(key: 5)
24+
tree.delete(key: 2)
25+
tree.delete(key: 1)
26+
tree.delete(key: 4)
27+
tree.delete(key: 3)

0 commit comments

Comments
 (0)
0