Skip to content

Commit cc125b4

Browse files
authored
Merge pull request kodecocodes#368 from barbaramartina/splay-tree
[FINISHED] 🌳 🌳 Splay Tree Implementation
2 parents fe52150 + 72b6ef6 commit cc125b4

40 files changed

+2079
-0
lines changed

Splay Tree/Images/SplayTreesWorstCaseExamples.svg

+2
Loading
31.4 KB
Loading
33.7 KB
Loading
29 KB
Loading
28 KB
Loading
25.1 KB
Loading

Splay Tree/Images/example1-1.png

13.6 KB
Loading

Splay Tree/Images/example1-2.png

15.1 KB
Loading

Splay Tree/Images/example1-3.png

14.4 KB
Loading

Splay Tree/Images/examplezig.svg

+2
Loading

Splay Tree/Images/examplezig1.png

6.43 KB
Loading

Splay Tree/Images/examplezig2.png

9.1 KB
Loading

Splay Tree/Images/examplezigzig.svg

+2
Loading

Splay Tree/Images/examplezigzig1.png

13.5 KB
Loading

Splay Tree/Images/examplezigzig2.png

14.9 KB
Loading

Splay Tree/Images/examplezigzig3.png

17.7 KB
Loading

Splay Tree/Images/worst-case-1.png

6.64 KB
Loading

Splay Tree/Images/worst-case-2.png

6.91 KB
Loading

Splay Tree/Images/worst-case-3.png

8.84 KB
Loading

Splay Tree/Images/worst-case-4.png

10.6 KB
Loading

Splay Tree/Images/worst-case-5.png

11.5 KB
Loading

Splay Tree/Images/worst-case-6.png

34.4 KB
Loading

Splay Tree/Images/zig.png

7.61 KB
Loading

Splay Tree/Images/zigzag1.png

13.6 KB
Loading

Splay Tree/Images/zigzag2.png

13.6 KB
Loading
37.9 KB
Loading

Splay Tree/Images/zigzig1.png

13.5 KB
Loading

Splay Tree/Images/zigzig2.png

14.8 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//: Playground - Splay Tree Implementation
2+
3+
4+
let splayTree = SplayTree(value: 1)
5+
splayTree.insert(value: 2)
6+
splayTree.insert(value: 10)
7+
splayTree.insert(value: 6)
8+
9+
splayTree.remove(value: 10)
10+
splayTree.remove(value: 6)
11+
12+
splayTree.insert(value: 55)
13+
splayTree.insert(value: 559)
14+
splayTree.remove(value: 2)
15+
splayTree.remove(value: 1)
16+
splayTree.remove(value: 55)
17+
splayTree.remove(value: 559)
18+
19+
splayTree.insert(value: 1843000)
20+
splayTree.insert(value: 1238)
21+
splayTree.insert(value: -1)
22+
splayTree.insert(value: 87)
23+
24+
splayTree.minimum()
25+
splayTree.maximum()
26+
27+
28+
29+

0 commit comments

Comments
 (0)