repl.it
@pCoding/

sort-cpp

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
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
27
28
29
30
31
#include <iostream>
#include <cstdlib>

//Сортировка вставками
void slist::isort(void){
    node* a, *b, *p, *h = NULL;
 
    for(node* i = lst; i != NULL; ) {
        a = i;
        i = i->next;
        b = h;
        for(p = NULL; (b != NULL) && (a->val > b->val); ) {
            p = b;
            b = b->next;
        }
 
        if(p == NULL){
            a->next = h;
            h       = a;
        } else {
            a->next = b;
            p->next = a;
        }
    }
    if(h != NULL) 
        lst = h;
}

int main() {
  std::cout << "Hello World!\n";
}
Fetching token
?