Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sortowanie_przez_wstawianie_polowkowe(int *table, int size)
- {
- int i;
- for (i = 1; i < size; i++)
- {
- int j, start, p, currentValue, half;
- currentValue = table[i];
- start = 0;
- p = i - 1;
- while (start <= p)
- {
- half = (start + p) / 2;
- if (currentValue < table[half])
- {
- p = half - 1;
- }
- else
- {
- start = half + 1;
- }
- }
- for (j = i - 1; j >= start; --j)
- {
- table[j + 1] = table[j];
- }
- table[start] = currentValue;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement