Skip to content

Commit 5d15f55

Browse files
Adding images for examples and rotation cases
1 parent 47a4122 commit 5d15f55

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

Splay Tree/readme.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@ Splay tree is a data structure, structurally identitical to a Balanced Binary Se
88

99
Given a node *a* if *a* is not the root, and *a* has a child *b*, and both *a* and *b* are left children or right children, a **Zig-Zig** is performed.
1010

11+
![ZigZigCase1](Images/zigzig1.png)
12+
13+
![ZigZigCase2](Images/zigzig2.png)
14+
1115
### Zig-Zag
1216

1317
Given a node *a* if *a* is not the root, and *a* has a child *b*, and *b* is the left child of *a* being the right child (or the opporsite), a **Zig-Zag** is performed.
1418

19+
![ZigZagCase1](Images/zigzag1.png)
20+
21+
![ZigZagCase2](Images/zigzag2.png)
22+
1523
### Zig
1624

1725
A **Zig** is performed when the node *a* to be rotated has the root as parent.
1826

27+
![ZigCase](Images/zig.png)
28+
29+
1930
## Splaying
2031

2132
## Operations
@@ -30,9 +41,20 @@ A **Zig** is performed when the node *a* to be rotated has the root as parent.
3041

3142
### Example 1
3243

44+
![ZigEx1](Images/examplezigzig1.png)
45+
46+
![ZigEx2](Images/examplezigzig2.png)
47+
48+
![ZigEx3](Images/examplezigzig3.png)
49+
50+
3351
### Example 2
3452

35-
### Example 3
53+
![ZigEx21](Images/example1-1.png)
54+
55+
![ZigEx22](Images/example1-2.png)
56+
57+
![ZigEx23](Images/example1-3.png)
3658

3759
## Advantages
3860

@@ -57,4 +79,4 @@ With *n* being the number of items in the tree.
5779
[Splay Tree on Wikipedia](https://en.wikipedia.org/wiki/Splay_tree)
5880
[Splay Tree by University of California in Berkeley - CS 61B Lecture 34](https://www.youtube.com/watch?v=G5QIXywcJlY)
5981

60-
*Written for Swift Algorithm Club by Mike Taghavi and Matthijs Hollemans*
82+
*Written for Swift Algorithm Club by Barbara Martina Rodeker*

0 commit comments

Comments
 (0)