Задача: Вычисление медианы заданной выборки
Исходник: Вычисление медианы заданной выборки #1, язык: C [code #108, hits: 8179]
автор: - [добавлен: 27.04.2006]
  1. /* bs03r.f -- translated by f2c (version 20000817).
  2. You must link the resulting object file with the libraries:
  3. -lf2c -lm (in that order)
  4. */
  5.  
  6. #include "f2c.h"
  7.  
  8. /* Subroutine */ int bs03r_c(real *x, integer *n, real *xmed)
  9. {
  10. extern /* Subroutine */ int bs03r1_c(integer *, real *);
  11. static integer n2;
  12.  
  13. /* Parameter adjustments */
  14. --x;
  15.  
  16. /* Function Body */
  17. bs03r1_c(n, &x[1]);
  18. n2 = *n / 2;
  19. *xmed = x[n2 + 1];
  20. if (n2 << 1 == *n) {
  21. *xmed = (x[n2] + x[n2 + 1]) * .5f;
  22. }
  23. return 0;
  24. } /* bs03r_c */
  25.  
Найдено на http://www.srcc.msu.su/

+добавить реализацию