@@ -28,7 +28,7 @@ public enum SplayOperation {
28
28
- Parameters:
29
29
- node SplayTree node to move up to the root
30
30
*/
31
- public static func splay< T: Comparable > ( node: Node < T > ) {
31
+ public static func splay< T> ( node: Node < T > ) {
32
32
33
33
while ( node. parent != nil ) {
34
34
operation ( forNode: node) . apply ( onNode: node)
@@ -44,7 +44,7 @@ public enum SplayOperation {
44
44
- Returns
45
45
- Operation Case zigZag - zigZig - zig
46
46
*/
47
- public static func operation< T: Comparable > ( forNode node: Node < T > ) -> SplayOperation {
47
+ public static func operation< T> ( forNode node: Node < T > ) -> SplayOperation {
48
48
49
49
if let parent = node. parent, let _ = parent. parent {
50
50
if ( node. isLeftChild && parent. isRightChild) || ( node. isRightChild && parent. isLeftChild) {
@@ -62,7 +62,7 @@ public enum SplayOperation {
62
62
- Parameters:
63
63
- onNode Node to splay up. Should be alwayas the node that needs to be splayed, neither its parent neither it's grandparent
64
64
*/
65
- public func apply< T: Comparable > ( onNode node: Node < T > ) {
65
+ public func apply< T> ( onNode node: Node < T > ) {
66
66
switch self {
67
67
case . zigZag:
68
68
assert ( node. parent != nil && node. parent!. parent != nil , " Should be at least 2 nodes up in the tree " )
@@ -84,7 +84,7 @@ public enum SplayOperation {
84
84
Performs a single rotation from a node to its parent
85
85
re-arranging the children properly
86
86
*/
87
- public func rotate< T: Comparable > ( child: Node < T > , parent: Node < T > ) {
87
+ public func rotate< T> ( child: Node < T > , parent: Node < T > ) {
88
88
89
89
assert ( child. parent != nil && child. parent!. value == parent. value, " Parent and child.parent should match here " )
90
90
@@ -610,7 +610,7 @@ extension SplayTree: CustomStringConvertible {
610
610
611
611
extension Node : CustomDebugStringConvertible {
612
612
public var debugDescription : String {
613
- var s = " value: \( value) "
613
+ var s = " value: \( String ( describing : value) ) "
614
614
if let parent = parent, let v = parent. value {
615
615
s += " , parent: \( v) "
616
616
}
0 commit comments