src/listmerger/utilities.cc
void
sortBySizeOfLists(const vector<Array<unsigned>*> &allLists,
                  unsigned sortedIndex [])
{
    vector<Array<unsigned>*>::const_iterator ite = allLists.begin();

    unsigned sizeHeap[allLists.size()];
    unsigned indexHeap[allLists.size()];

    unsigned index = 0;

    unsigned heapSize = 0;

    while (ite != allLists.end()) {
        unsigned sizeOfList = (*ite)->size();

        heapInsert(sizeOfList, index++, sizeHeap, indexHeap, heapSize);

        ite++;

    }//end while

    index = 0;

    while (heapSize > 0) {
        sortedIndex[index++] = indexHeap[0];
        heapDelete(sizeHeap, indexHeap, heapSize);
    }//end while

}
/*
  Sort the inverted list with increasing order
  according to the their sizes
  by heapSort

  This function is used in MergeOpt.

 */
Sort the inverted list with increasing order
according to the their sizes
by heapSort

This function is used in MergeOpt.
Sort the inverted list with increasing order according to the their sizes by heapSort This function is used in MergeOpt .
void
sortBySizeOfLists(const vector<Array<unsigned>*> &allLists,
                  unsigned sortedIndex [])
{
    vector<Array<unsigned>*>::const_iterator ite = allLists.begin();
    unsigned sizeHeap[allLists.size()];
    unsigned indexHeap[allLists.size()];
    unsigned index = 0;
    unsigned heapSize = 0;
    while (ite != allLists.end()) {
        unsigned sizeOfList = (*ite)->size();
        heapInsert(sizeOfList, index++, sizeHeap, indexHeap, heapSize);
        ite++;
    }
    index = 0;
    while (heapSize > 0) {
        sortedIndex[index++] = indexHeap[0];
        heapDelete(sizeHeap, indexHeap, heapSize);
    }
}
void sortBySizeOfLists ( const vector < Array < unsigned > * > & allLists , unsigned sortedIndex [ ] ) { vector < Array < unsigned > * > :: const_iterator ite = allLists . begin ( ) ; unsigned sizeHeap [ allLists . size ( ) ] ; unsigned indexHeap [ allLists . size ( ) ] ; unsigned index = 0 ; unsigned heapSize = 0 ; while ( ite != allLists . end ( ) ) { unsigned sizeOfList = ( * ite ) -> size ( ) ; heapInsert ( sizeOfList , index ++ , sizeHeap , indexHeap , heapSize ) ; ite ++ ; } index = 0 ; while ( heapSize > 0 ) { sortedIndex [ index ++ ] = indexHeap [ 0 ] ; heapDelete ( sizeHeap , indexHeap , heapSize ) ; } }
Sort the inverted list with increasing order
according to the their sizes
by heapSort
Sort the inverted list with increasing order according to the their sizes by heapSort
//end while //end while