Skip to content

Commit

Permalink
Update pydatastructs/trees/binary_trees.py
Browse files Browse the repository at this point in the history
  • Loading branch information
czgdp1807 authored Mar 18, 2020
1 parent a43e594 commit 5e32214
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pydatastructs/trees/binary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,25 +1048,25 @@ class SplayTree(AVLTree):
[1] https://en.wikipedia.org/wiki/Splay_tree
"""
def _zig(self,x,p):
def _zig(self, x, p):
if self.tree[p].left == x:
super(SplayTree, self)._right_rotate(p, x)
else:
super(SplayTree, self)._left_rotate(p, x)

def _zig_zig(self,x,p):
def _zig_zig(self, x, p):
super(SplayTree, self)._right_rotate(self.tree[p].parent, p)
super(SplayTree, self)._right_rotate(p, x)

def _zig_zag(self,x,p):
def _zig_zag(self, x, p):
super(SplayTree, self)._left_rotate(p, x)
super(SplayTree, self)._right_rotate(self.tree[x].parent, x)

def _zag_zag(self,x,p):
def _zag_zag(self, x, p):
super(SplayTree, self)._left_rotate(self.tree[p].parent, p)
super(SplayTree, self)._left_rotate(p, x)

def _zag_zig(self,x,p):
def _zag_zig(self, x, p):
super(SplayTree, self)._right_rotate(p, x)
super(SplayTree, self)._left_rotate(self.tree[x].parent, x)

Expand Down

0 comments on commit 5e32214

Please sign in to comment.