1.4 Implementation von "siftup"

void siftup(n) {
   int i = n;
   while (i != 1) {    //i ist nicht Wurzel
      int p = i / 2;      //Vater von i
      if (A[p] > A[i])   //Heap-Eigenschaft gestört
         vertausche p und i;
      i = p;
   }
}

zurück Inhalt vor