Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/hp2graph/sort.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include "hp2graph.h"

void sortEntries(void)
{
  int i,j;
  
  for (i = 0; i < entrysize - 1; i++) {
    int max = i;
    double area = entrydata[max]->area;
    for (j = i+1; j < entrysize; j++) {
      if (entrydata[j]->area > area) {
	max = j;
	area = entrydata[max]->area;
      }
    }
    if(max!=i) {
      Entry *t = entrydata[i]; 
      entrydata[i] =  entrydata[max];
      entrydata[max] = t;
    }
  }    
}

  

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.