blob: b1d15cfb4af99a0b9bca0a7ec7bfc28a661107fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// SortTools_StraightInsertionSort.gxx
// cree le 04/11/91 par ASI
// Reference : Software Conponents with ADA, Grady Booch.
void SortTools_StraightInsertionSort::Sort(Array& TheArray,
const Comparator& Comp)
{
Item TempItem;
Standard_Integer J;
for(Standard_Integer I = TheArray.Lower() + 1; I <= TheArray.Upper(); I++) {
TempItem = TheArray(I);
J = I;
while (Comp.IsLower(TempItem, TheArray(J - 1))) {
TheArray(J) = TheArray(J - 1);
J = J - 1;
if (J == TheArray.Lower()) break;
}
TheArray(J) = TempItem;
}
}
|