Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0
  •   was successfully added to your cart.
  • Home
  • Buy proxies
  • Extra features
  • Help
  • Contact
  • Login
  • 50% OFF
    BUY NOW!
    50
    PROXIES
    $19
    --------------------
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    $29
    $49
    $109
    $179
    $299
    --------------------
    --------------------
    --------------------
    --------------------
    --------------------
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    100
    200
    500
    1,000
    2,000
    TOP SELLER
    BEST VALUE
    For All Private Proxies!

I wanted to get an understanding of different data structures and therefore implemented an AVL tree in python. However I somehow messed things up when it comes to insertion and therefore rotation.

If I run my module my terminal just spits out the root node and the node with value 3 for the first test and only the root for the second one. What is it I am doing wrong? I would appreciate another pairs of eyes as I miss the forest for the trees by trying to debug this πŸ™

"""AVL-Tree implementation."""   class Node():     """Class representating an AVL node."""      __slots__ = ["data", "height", "key", "left", "right"]      def __init__(self, key, data=None):         """         Create new node.          :param {any} key: Key to use for operations.         :param {any} data: Payload to store.         """         self.data = [data]         self.height = 1         self.key = key         self.left = self.right = None      def __repr__(self):         """Return string representation."""         return "{} ({} => {})".format(self.height, self.key, self.data)  def get_height(node):     """     Return height for node.      :param {Node} node: Node to get height for.     """     return node.height if node else 0  def in_order(node):     """     Return node values in order.      :param {Node} node: Node to process.     """     if not node:         return     in_order(node.left)     print(node)     in_order(node.right)  def insert(node, key, data=None):     """     Insert new data.      :param {Node} node: Current node.     :param {any} key: Node key.     :param {any} data: Payload.     """     if not node:         return Node(key, data)     elif key == node.key:         node.data.append(data)         return node     elif key < node.key:         node.left = insert(node.left, key, data)     else:         node.right = insert(node.right, key, data)     left_height = get_height(node.left)     right_height = get_height(node.right)     node.height = max(left_height, right_height) + 1     balance = left_height - right_height     # Inbalance left     if balance == 2:         # left right => left left         if key > node.left.key:             node.left = rotate_left(node.left)         # left left         rotate_right(node)     # Inbalance right     elif balance == -2:         # right left => right right         if key < node.right.key:             node.right = rotate_right(node.right)         # right right         rotate_left(node)     return node  def pre_order(node):     """."""     if node:         print(node)         pre_order(node.left)         pre_order(node.right)  def rotate_left(node):     r"""     Left node rotation (balance == -2).      1 (node)      \            2       2     =>   / \        \        1   3         3      :param {Node} node: Node to rotate.     """     child = node.right     child.left, node.right = node, child.left     return node  def rotate_right(node):     r"""     Right node rotation.          3 (node)        /          2       2     =>   / \      /          1   3     1      :param {Node} node: Node to rotate on.     """     child = node.left     child.right, node.left = node, child.right     return node   if __name__ == "__main__":     root = Node(0)     for i in range(1, 4):         root = insert(root, i)     in_order(root)     print(".....")     root2 = Node(0)             for i in range(1, 4):         root2 = insert(root, i)     in_order(root2) 

Thank you for your help!

βœ“Β Extra quality

ExtraProxies brings the best proxy quality for you with our private and reliable proxies

βœ“Β Extra anonymity

Top level of anonymity and 100% safe proxies – this is what you get with every proxy package

βœ“Β Extra speed

1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!

50 proxies

$19/month

50% DISCOUNT!
$0.38 per proxy
βœ“ Private
βœ“ Elite
βœ“ Anonymous
Buy now

100 proxies

$29/month

50% DISCOUNT!
$0.29 per proxy
βœ“ Private
βœ“ Elite
βœ“ Anonymous
Buy now

200 proxies

$49/month

50% DISCOUNT!
$0.25 per proxy
βœ“ Private
βœ“ Elite
βœ“ Anonymous
Buy now

500 proxies

$109/month

50% DISCOUNT!
$0.22 per proxy
βœ“ Private
βœ“ Elite
βœ“ Anonymous
Buy now

1,000 proxies

$179/month

50% DISCOUNT!
$0.18 per proxy
βœ“ Private
βœ“ Elite
βœ“ Anonymous
Buy now

2,000 proxies

$299/month

50% DISCOUNT!
$0.15 per proxy
βœ“ Private
βœ“ Elite
βœ“ Anonymous
Buy now

USA proxy location

We offer premium quality USA private proxies – the most essential proxies you can ever want from USA

100% anonymous

Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies

Unlimited bandwidth

Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!

Superfast speed

Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!

99,9% servers uptime

Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems

No usage restrictions

You have freedom to use your proxies with every software, browser or website you want without restrictions

Perfect for SEO

We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies

Big discounts

Buy more proxies and get better price – we offer various proxy packages with great deals and discounts

Premium support

We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!

Satisfaction guarantee

24/7 premium support, free proxy activation and 100% safe payments! Best reliability private proxies for your needs!

Best Proxy Packs

  • 2,000 Private Proxies $600.00 $299.00 / month
  • 1,000 Private Proxies $360.00 $179.00 / month

Quick Links

  • More information
  • Contact us
  • Privacy Policy
  • Terms and Conditions

Like And Follow Us


Copyright ExtraProxies.com | All Rights Reserved.
  • Checkout
  • Contact
  • Help
  • Home
  • My Account
  • My Cart
  • News
  • Privacy Policy
  • Proxy features
  • Proxy packs
  • Terms and Conditions
Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0 items