21 #ifndef SELDON_FILE_FUNCTIONS_ARRAYS_CXX
64 template<
class T,
class Storage,
class Allocator>
105 template<
class T,
class Storage,
class Allocator>
106 void QuickSort(
long m,
long n,
113 QuickSort(p+1, n, t);
119 template<
class T1,
class Storage1,
class Allocator1,
120 class T2,
class Storage2,
class Allocator2>
165 template<
class T1,
class Storage1,
class Allocator1,
166 class T2,
class Storage2,
class Allocator2>
167 void QuickSort(
long m,
long n,
174 QuickSort(m, p, t1, t2);
175 QuickSort(p+1, n, t1, t2);
181 template<
class T1,
class Storage1,
class Allocator1,
182 class T2,
class Storage2,
class Allocator2,
183 class T3,
class Storage3,
class Allocator3>
234 template<
class T1,
class Storage1,
class Allocator1,
235 class T2,
class Storage2,
class Allocator2,
236 class T3,
class Storage3,
class Allocator3>
237 void QuickSort(
long m,
long n,
245 QuickSort(m, p, t1, t2, t3);
246 QuickSort(p+1, n, t1, t2, t3);
255 template<
class T,
class Storage,
class Allocator>
261 bool array_sorted =
true;
262 for (
long k = m; k < n; k++)
263 if (tab1(k+1) < tab1(k))
264 array_sorted =
false;
269 long inc = 1, ind = 0, current, i, j, sup;
273 while (inc < (n - m + 1) )
279 for (i = m; i <= n - inc; i += 2 * inc)
296 while (current < sup && tab1(j) > tab1(current))
298 tab1t(ind-m) = tab1(current);
304 tab1t(ind - m) = tab1(j);
312 for (j = current; j < sup; j++)
314 tab1t(ind - m) = tab1(j);
323 for (current = j; current < i + inc; current++)
325 tab1t(ind - m) = tab1(current);
333 for (i = m; i < ind; i++)
334 tab1(i) = tab1t(i - m);
345 template<
class T1,
class Storage1,
class Allocator1,
346 class T2,
class Storage2,
class Allocator2>
353 bool array_sorted =
true;
354 for (
long k = m; k < n; k++)
355 if (tab1(k+1) < tab1(k))
356 array_sorted =
false;
361 long inc = 1, ind = 0, current, i, j, sup;
365 while (inc < n - m + 1)
367 for (i = m; i <= n - inc; i += 2 * inc)
380 while (current < sup && tab1(j) > tab1(current))
382 tab1t(ind - m) = tab1(current);
383 tab2t(ind - m) = tab2(current);
387 tab1t(ind - m) = tab1(j);
388 tab2t(ind - m) = tab2(j);
393 for (j = current; j < sup; j++)
395 tab1t(ind - m) = tab1(j);
396 tab2t(ind - m) = tab2(j);
403 for (current = j; current < i + inc; current++)
405 tab1t(ind - m) = tab1(current);
406 tab2t(ind - m) = tab2(current);
413 for (i = m; i < ind; i++)
415 tab1(i) = tab1t(i - m);
416 tab2(i) = tab2t(i - m);
427 template<
class T1,
class Storage1,
class Allocator1,
428 class T2,
class Storage2,
class Allocator2,
429 class T3,
class Storage3,
class Allocator3>
437 bool array_sorted =
true;
438 for (
long k = m; k < n; k++)
439 if (tab1(k+1) < tab1(k))
440 array_sorted =
false;
445 long inc = 1, ind = 0, current, i, j, sup;
450 while (inc < n - m + 1)
452 for (i = m; i <= n - inc; i += 2 * inc)
465 while (current < sup && tab1(j) > tab1(current))
467 tab1t(ind - m) = tab1(current);
468 tab2t(ind - m) = tab2(current);
469 tab3t(ind - m) = tab3(current);
473 tab1t(ind - m) = tab1(j);
474 tab2t(ind - m) = tab2(j);
475 tab3t(ind - m) = tab3(j);
480 for (j = current; j < sup; j++)
482 tab1t(ind - m) = tab1(j);
483 tab2t(ind - m) = tab2(j);
484 tab3t(ind - m) = tab3(j);
491 for (current = j; current < i + inc; current++)
493 tab1t(ind - m) = tab1(current);
494 tab2t(ind - m) = tab2(current);
495 tab3t(ind - m) = tab3(current);
502 for (i = m; i < ind; i++)
504 tab1(i) = tab1t(i - m);
505 tab2(i) = tab2t(i - m);
506 tab3(i) = tab3t(i - m);
526 template<
class Storage1,
class Allocator1,
527 class T2,
class Storage2,
class Allocator2 >
537 for (
long i = 1; i < n; i++)
560 template<
class T,
class Storage1,
class Allocator1>
569 for (
long i = 1; i < n; i++)
581 template<
class T,
class Storage1,
class Allocator1>
584 long nb = Node.GetM();
594 template<
class T,
class Storage1,
class Allocator1,
595 class T2,
class Storage2,
class Allocator2>
602 Sort(n, Node, Node2);
605 for (
long i = 1; i < n; i++)
609 Node2(nb) = Node2(i);
618 template<
class T,
class Storage1,
class Allocator1>
629 template<
class T,
class Storage1,
class Allocator1,
630 class T2,
class Storage2,
class Allocator2>
634 long n = Node.GetM();
638 RemoveDuplicate(n, Node, Node2);
645 template<
class T,
class Storage1,
class Allocator1>
648 long n = Node.GetM();
658 template<
class T,
class Storage,
class Allocator>
669 template<
class T1,
class Storage1,
class Allocator1,
670 class T2,
class Storage2,
class Allocator2>
674 MergeSort(m, n, V, V2);
682 template<
class T1,
class Storage1,
class Allocator1,
683 class T2,
class Storage2,
class Allocator2,
684 class T3,
class Storage3,
class Allocator3>
689 MergeSort(m, n, V, V2, V3);
694 template<
class T,
class Storage,
class Allocator>
705 template<
class T1,
class Storage1,
class Allocator1,
706 class T2,
class Storage2,
class Allocator2>
710 Sort(0, n - 1, V, V2);
718 template<
class T1,
class Storage1,
class Allocator1,
719 class T2,
class Storage2,
class Allocator2,
720 class T3,
class Storage3,
class Allocator3>
725 Sort(0, n - 1, V, V2, V3);
730 template<
class T,
class Storage,
class Allocator>
733 Sort(0, V.GetM() - 1, V);
741 template<
class T1,
class Storage1,
class Allocator1,
742 class T2,
class Storage2,
class Allocator2>
746 Sort(0, V.GetM() - 1, V, V2);
754 template<
class T1,
class Storage1,
class Allocator1,
755 class T2,
class Storage2,
class Allocator2,
756 class T3,
class Storage3,
class Allocator3>
761 Sort(0, V.GetM() - 1, V, V2, V3);
770 template<
class T,
class Storage,
class Allocator>
773 for (
long i = 0; i < X.GetM(); i++)
783 #define SELDON_FILE_FUNCTIONS_ARRAYS_CXX