测试

  1. private void adjust(int i) {
  2.  
  3.    int parent = (i + K) / 2;
  4.  
  5.    int temp;
  6.  
  7.    while (parent > 0) {
  8.  
  9.       if (b[i] > b[LS[parent]]) {
  10.  
  11.          temp = LS[parent];
  12.          LS[parent] = i;
  13.          i = temp;
  14.       }
  15.  
  16.       parent = parent / 2;
  17.    }
  18.  
  19.    LS[0] = i;
  20.  
  21.  
  22. }

posted on 2013-09-12 11:01  zjgtan  阅读(110)  评论(0编辑  收藏  举报

导航