#  _*_coding:utf-8 _*_
"""Create a heap data structure."""
from __future__ import division
import math


class Heap(object):
    """Create class Heap."""

    def __init__(self):
        """Initilializating for Heap class."""
        self.high_low = []

    def get_parent(self, index):
        """Index number of Node's parent."""
        return (index - 1) // (2)

    def get_left(self, index):
        """Left child."""
        return 2 * index + 1

    def get_right(self, index):
        """Right child."""
        return 2 * index + 2

@@ -535,8 +535,708 @@
 dex + 2%0A
+%0A    def compare_parent(self, index):%0A        %22%22%22Compare node it parent.%22%22%22%0A        while True:%0A            left = self.get_left(index)%0A            right = self.get_right(index)%0A            if left %3C= len(self.high_low) and self.high_low%5Bleft%5D %3E self.high_low%5Bindex%5D:%0A                largest = left%0A            else:%0A                largest = index%0A            if right %3C= len(self.high_low) and self.high_low%5Bright%5D %3E self.high_low%5Blargest%5D:%0A                largest = right%0A            if largest != index:%0A                temp = self.high_low%5Bindex%5D%0A                self.high_low%5Bindex%5D = self.high_low%5Blargest%5D%0A                self.high_low%5Blargest%5D = temp%0A            else:%0A                break%0A

create compare node it parent