ns-allinone-2.35/ns-2.35/diffserv/ew.cc
int EWdetectorB::getMedianAList(int index, int count) {
  int m;
  
  if (!count)
    return 0;

  sortAList();
  //printAList();

  // Pick the entry with median avg_rate
  m = (int) (count / 2);
  if (2 * m == count) {
    return((getRateAList(index + m - 1) + getRateAList(index + m)) / 2);
  } else {
    return(getRateAList(index + m));
  }
}
// Get the median for a part of AList 
//   starting from index with count entries
Get the median for a part of AList
starting from index with count entries
Get the median for a part of AList starting from index with count entries
int EWdetectorB::getMedianAList(int index, int count) {
  int m;
  if (!count)
    return 0;
  sortAList();
  m = (int) (count / 2);
  if (2 * m == count) {
    return((getRateAList(index + m - 1) + getRateAList(index + m)) / 2);
  } else {
    return(getRateAList(index + m));
  }
}
int EWdetectorB :: getMedianAList ( int index , int count ) { int m ; if ( ! count ) return 0 ; sortAList ( ) ; m = ( int ) ( count / 2 ) ; if ( 2 * m == count ) { return ( ( getRateAList ( index + m - 1 ) + getRateAList ( index + m ) ) / 2 ) ; } else { return ( getRateAList ( index + m ) ) ; } }
Get the median for a part of AList
starting from index with count entries
Get the median for a part of AList starting from index with count entries
//printAList(); // Pick the entry with median avg_rate