@@ -28,7 +28,7 @@ public enum SplayOperation {
2828 - Parameters:
2929 - node SplayTree node to move up to the root
3030 */
31- public static func splay< T: Comparable > ( node: Node < T > ) {
31+ public static func splay< T> ( node: Node < T > ) {
3232
3333 while ( node. parent != nil ) {
3434 operation ( forNode: node) . apply ( onNode: node)
@@ -44,7 +44,7 @@ public enum SplayOperation {
4444 - Returns
4545 - Operation Case zigZag - zigZig - zig
4646 */
47- public static func operation< T: Comparable > ( forNode node: Node < T > ) -> SplayOperation {
47+ public static func operation< T> ( forNode node: Node < T > ) -> SplayOperation {
4848
4949 if let parent = node. parent, let _ = parent. parent {
5050 if ( node. isLeftChild && parent. isRightChild) || ( node. isRightChild && parent. isLeftChild) {
@@ -62,7 +62,7 @@ public enum SplayOperation {
6262 - Parameters:
6363 - onNode Node to splay up. Should be alwayas the node that needs to be splayed, neither its parent neither it's grandparent
6464 */
65- public func apply< T: Comparable > ( onNode node: Node < T > ) {
65+ public func apply< T> ( onNode node: Node < T > ) {
6666 switch self {
6767 case . zigZag:
6868 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 {
8484 Performs a single rotation from a node to its parent
8585 re-arranging the children properly
8686 */
87- public func rotate< T: Comparable > ( child: Node < T > , parent: Node < T > ) {
87+ public func rotate< T> ( child: Node < T > , parent: Node < T > ) {
8888
8989 assert ( child. parent != nil && child. parent!. value == parent. value, " Parent and child.parent should match here " )
9090
@@ -610,7 +610,7 @@ extension SplayTree: CustomStringConvertible {
610610
611611extension Node : CustomDebugStringConvertible {
612612 public var debugDescription : String {
613- var s = " value: \( value) "
613+ var s = " value: \( String ( describing : value) ) "
614614 if let parent = parent, let v = parent. value {
615615 s += " , parent: \( v) "
616616 }
0 commit comments