Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/97#discussion_r11193245
  
    --- Diff: python/pyspark/rdd.py ---
    @@ -91,6 +92,58 @@ def __exit__(self, type, value, tb):
             if _spark_stack_depth == 0:
                 self._context._jsc.setCallSite(None)
     
    +class MaxHeapQ(object):
    +    """
    +    An implementation of MaxHeap.
    +
    +    """
    +    
    +    def __init__(self):
    +        # we start from q[1], this makes calculating children as trivial 
as 2 * k
    +        self.q = [0]
    +        
    +    def _swim(self, k):
    +        while (k > 1) and (self.q[k/2] < self.q[k]):
    +            self._swap(k, k/2)
    +            k = k/2
    +            
    +    def _swap(self, i, j):
    +        t = self.q[i]
    +        self.q[i] = self.q[j]
    +        self.q[j] = t
    +
    +    def _sink(self, k):
    +        N=len(self.q)-1
    --- End diff --
    
    Put spaces around the operators (`=`, `-`, etc)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to