diff --git a/Home/PL/HW/Stack Calculator/Yar/appCalk.exe b/Home/PL/HW/Stack Calculator/Yar/appCalk.exe deleted file mode 100644 index c667d5c..0000000 Binary files a/Home/PL/HW/Stack Calculator/Yar/appCalk.exe and /dev/null differ diff --git a/Home/PL/HW/Stack Calculator/Yar/function.c b/Home/PL/HW/Stack Calculator/Yar/function.c deleted file mode 100644 index 3632b5e..0000000 --- a/Home/PL/HW/Stack Calculator/Yar/function.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "header.h" - -void linked_print(LinkedList *l) -{ - while (l != NULL) - { - printf("%lF\n", l->x); - l = l->next; - } -} - -LinkedList *add_head(LinkedList *l, double x) -{ - if (l == NULL) - { - l = malloc(sizeof(LinkedList)); - if (l == NULL) - exit(1); - l->x = x; - l->next = NULL; - } - - if (l->x == 0.0) - { - l->x = x; - l->next = NULL; - return l; - } - - LinkedList *tmp = malloc(sizeof(LinkedList)); - if (tmp == NULL) - exit(1); - - tmp->next = l; - tmp->x = x; - return tmp; -} - -LinkedList *del_head(LinkedList *l) -{ - if (l == NULL) - return NULL; - else if (l->next == NULL) - { - free(l); - l = NULL; - return NULL; - } - LinkedList *tmp = l->next; - free(l); - l = NULL; - return tmp; -} - -int len(LinkedList *l) -{ - int res = 0; - while (l != NULL) - { - res++; - l = l->next; - } - return res; -} - -LinkedList get(LinkedList *l, int n) -{ - if (n > len(l)) - exit(3); - int i; - for (i = 0; i < n; i++) - { - l = l->next; - } - return *l; -} \ No newline at end of file diff --git a/Home/PL/HW/Stack Calculator/Yar/general.c b/Home/PL/HW/Stack Calculator/Yar/general.c deleted file mode 100644 index d75e610..0000000 --- a/Home/PL/HW/Stack Calculator/Yar/general.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "header.h" -#include - -int main(int argc, char *argv[]) -{ - srand(time(0)); - LinkedList *numbers = malloc(sizeof(LinkedList)); - if (numbers == NULL) - exit(1); - - char c; - char flag = 'n'; - - while ((c = getchar()) != EOF) - { - if (c == '\n') - { - break; - } - else if (c == ' ') - { - flag = 's'; - continue; - } - - switch (c) - { - case '0' ... '9': - if (flag == 's') - { - numbers = add_head(numbers, (double)(c - '0')); - flag = 'n'; - } - else - { - double a = get(numbers, 0).x; - numbers = del_head(numbers); - a = a * 10 + c - '0'; - numbers = add_head(numbers, a); - } - break; - - case '+': - case '-': - case '*': - case '/': - if (len(numbers) < 2) - { - printf("Invalid expression\n"); - exit(2); - } - - double a = get(numbers, 0).x; - numbers = del_head(numbers); - double b = get(numbers, 0).x; - numbers = del_head(numbers); - - b = (c == '+') ? b + a : b; - b = (c == '-') ? b - a : b; - b = (c == '*') ? b * a : b; - b = (c == '/') ? b / a : b; - - numbers = add_head(numbers, b); - break; - } - } - - printf("res: %lF", get(numbers, 0).x); - - free(numbers); - return 0; -} \ No newline at end of file diff --git a/Home/PL/HW/Stack Calculator/Yar/header.h b/Home/PL/HW/Stack Calculator/Yar/header.h deleted file mode 100644 index ca9cbfc..0000000 --- a/Home/PL/HW/Stack Calculator/Yar/header.h +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include -#include - -#define N 5 - -typedef struct LinkedList -{ - double x; - struct LinkedList *next; -} LinkedList; - -void linked_print(LinkedList *l); -LinkedList *add_head(LinkedList *l, double x); -LinkedList *del_head(LinkedList *l); -int len(LinkedList *l); -LinkedList get(LinkedList *l, int n); \ No newline at end of file diff --git a/Home/PL/HW/Stack Calculator/calkApp.exe b/Home/PL/HW/Stack Calculator/calkApp.exe deleted file mode 100644 index 7928d5f..0000000 Binary files a/Home/PL/HW/Stack Calculator/calkApp.exe and /dev/null differ diff --git a/Home/PL/HW/Stack Calculator/head.h b/Home/PL/HW/Stack Calculator/head.h deleted file mode 100644 index b947d0f..0000000 --- a/Home/PL/HW/Stack Calculator/head.h +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include -#include -#include - -typedef struct node { - int x; - struct node* next; -}Plate; - -void print_plates(Plate* plates); -Plate* push(Plate* plates, int x); -Plate* remove_plate(Plate* plates); -int pop(Plate** plates); -int len(Plate* plates); -int isnm(char *str); \ No newline at end of file diff --git a/Home/PL/HW/Stack Calculator/lib.c b/Home/PL/HW/Stack Calculator/lib.c deleted file mode 100644 index b39db14..0000000 --- a/Home/PL/HW/Stack Calculator/lib.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "head.h" - -void print_plates(Plate *plates) -{ - if (plates == NULL) - { - printf("[%p]\n", plates); - return; - } - while(plates){ - printf("[%14p]->[%14p] ", plates, plates->next); - printf("data: [%4d]\n", plates->x); - plates = plates->next; - } - printf("-------------\n"); -} - -Plate* push(Plate* plates, int d){ - Plate *temp = NULL; - if((temp=malloc(sizeof(Plate)))==NULL){ - perror("malloc:NULL"); - exit(2); - } - temp->x = d; - if(plates==NULL) temp->next=NULL; - else{ - temp->next=plates; - } - return temp; -} - -Plate* del_head(Plate* plates){ - Plate *temp=plates; - if(plates==NULL) return NULL; - if(plates->next==NULL){ - free(plates); - return NULL; - } - plates = plates->next; - free(temp); - return plates; -} - -int len(Plate* plates){ - int ans = 0; - Plate *temp = plates; - if(plates==NULL) return 0; - while(temp){ - ans++; - temp=temp->next; - } - return ans; -} - -int pop(Plate** plates){ - int i; - if(*plates==NULL){ - printf("Error"); - exit(4); - } - i = (*plates)->x; - *plates = del_head(*plates); - return i; -} - -int isnm(char *str){ - int i = 0, n = strlen(str); - for(i=0; iname); - n = n->next; - } -} - -Node *add_tail(Node *n, char s[]) -{ - if (n == NULL) - { - if ((n = malloc(sizeof(Node))) == NULL) - { - printf("could not malloc\n"); - exit(1); - } - n->next = NULL; - n->prev = NULL; - memcpy(n->name, s, LEN); - return n; - } - if (!strcmp(n->name, "\0")) - { - memcpy(n->name, s, LEN); - n->next = NULL; - n->prev = NULL; - return n; - } - Node *res = n; - while (n->next != NULL){ - printf("%p\n", n); - n = n->next; - } - Node *tmp = malloc(sizeof(Node)); - memcpy(tmp->name, s, LEN); - tmp->prev = n; - n->next = tmp; - return res; -} - -Node get(Node *node, int n) -{ - int i; - for (i = 0; i < n; i++) - { - node = node->next; - } - return *node; -} - -int len(Node *n) -{ - int res = 0; - while (n != NULL) - { - res++; - n = n->next; - } - return res; -} - -Node *xor_find(Node *n1, Node *n2) -{ - int i, j, f = 0; - Node *res = NULL; - if ((res = malloc(sizeof(Node))) == NULL) - { - printf("could not malloc\n"); - exit(3); - } - - for (i = 0; i < len(n1); i++) - { - for (j = 0; j < len(n2); j++) - { - if (strcmp(get(n1, i).name, get(n2, j).name) == 0) - { - f = 1; - } - } - if (f == 0) - res = add_tail(res, get(n1, i).name); - f = 0; - } - - for (i = 0; i < len(n2); i++) - { - for (j = 0; j < len(n1); j++) - { - if (strcmp(get(n2, i).name, get(n1, j).name) == 0) - { - f = 1; - } - } - if (f == 0) - res = add_tail(res, get(n2, i).name); - f = 0; - } - - return res; -} \ No newline at end of file diff --git a/Home/PL/HW/array_xor/gen.c b/Home/PL/HW/array_xor/gen.c deleted file mode 100644 index 5f174f0..0000000 --- a/Home/PL/HW/array_xor/gen.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "header.h" - -int main(int argc, char *argv[]) -{ - printf("Cto-Nibud\n"); - srand(time(0)); - Node *n1 = NULL; - Node *n2 = NULL; - Node *n3 = NULL; - - if ((n1 = malloc(sizeof(Node))) == NULL || (n2 = malloc(sizeof(Node))) == NULL || (n3 = malloc(sizeof(Node))) == NULL) - { - printf("could not malloc\n"); - exit(2); - } - n1 = add_tail(n1, "bebebe"); - - printf("Error here 1\n"); - int i; - for (i = 0; i < COUNT; i++) - { - char s[LEN]; - int j; - printf("sss\n"); - for (j = 0; j < LEN - 1; j++) - s[j] = 'a' + rand() % 2; - s[LEN - 1] = '\0'; - - n1 = add_tail(n1, s); - printf("11"); - for (j = 0; j < LEN - 1; j++){ - s[j] = 'a' + rand() % 2; - printf("22"); - } - s[LEN - 1] = '\0'; - n2 = add_tail(n2, s); - } - - printf("Source arrays:\n"); - node_print(n1); - printf("\n"); - node_print(n2); - - n3 = xor_find(n1, n2); - - printf("\nFinal array:\n"); - node_print(n3); - - free(n1); - free(n2); - free(n3); - - return 0; -} \ No newline at end of file diff --git a/Home/PL/HW/array_xor/header.h b/Home/PL/HW/array_xor/header.h deleted file mode 100644 index 6fc27a4..0000000 --- a/Home/PL/HW/array_xor/header.h +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include - -#define COUNT 3 -#define LEN 3 - -typedef struct Node -{ - char name[LEN]; - struct Node *next; - struct Node *prev; -} Node; - -void node_print(Node *n); -Node *add_tail(Node *n, char s[]); -Node get(Node *node, int n); -Node *xor_find(Node *n1, Node *n2); -int len(Node *n); \ No newline at end of file diff --git a/Home/PL/HW/zero_find/gen.c b/Home/PL/HW/zero_find/gen.c deleted file mode 100644 index 7b23639..0000000 --- a/Home/PL/HW/zero_find/gen.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include - -double f(double x) { return exp(x) + sin(2.0 * x); } - -int main(int argc, char *argv[]) { - srand(time(0)); - - double start = -4.0, finish = -3.0, e = 1e-6, mid = (finish + start) / 2.0; - - if (f(start) * f(finish) > 0) { - printf("Could not find\n"); - exit(0); - } - - while (fabs(f(mid)) >= e) { - mid = (finish + start) / 2.0; - if (f(mid) > 0) { - start = (f(start) > f(finish)) ? mid : start; - finish = (f(start) < f(finish)) ? mid : finish; - } else { - start = (f(start) < f(finish)) ? mid : start; - finish = (f(start) > f(finish)) ? mid : finish; - } - } - - printf("Found: %lF\n", start); - - return 0; -} \ No newline at end of file diff --git a/Home/PL/HW/DZf28.03/SR2.zip b/Homework/DZf28.03/SR2.zip similarity index 100% rename from Home/PL/HW/DZf28.03/SR2.zip rename to Homework/DZf28.03/SR2.zip diff --git a/Home/PL/HW/DZf28.03/fmain.c b/Homework/DZf28.03/fmain.c similarity index 100% rename from Home/PL/HW/DZf28.03/fmain.c rename to Homework/DZf28.03/fmain.c diff --git a/Home/PL/HW/DZf28.03/funcHeader.h b/Homework/DZf28.03/funcHeader.h similarity index 100% rename from Home/PL/HW/DZf28.03/funcHeader.h rename to Homework/DZf28.03/funcHeader.h diff --git a/Home/PL/HW/DZf28.03/functions.c b/Homework/DZf28.03/functions.c similarity index 100% rename from Home/PL/HW/DZf28.03/functions.c rename to Homework/DZf28.03/functions.c diff --git a/Home/PL/HW/DZf28.03/professions.txt b/Homework/DZf28.03/professions.txt similarity index 100% rename from Home/PL/HW/DZf28.03/professions.txt rename to Homework/DZf28.03/professions.txt diff --git a/Home/PL/HW/DZf28.03/srez1.exe b/Homework/DZf28.03/srez1.exe similarity index 100% rename from Home/PL/HW/DZf28.03/srez1.exe rename to Homework/DZf28.03/srez1.exe diff --git a/Home/PL/HW/Hanoi Towers/appHT b/Homework/Hanoi Towers/appHT similarity index 100% rename from Home/PL/HW/Hanoi Towers/appHT rename to Homework/Hanoi Towers/appHT diff --git a/Home/PL/HW/Hanoi Towers/func.c b/Homework/Hanoi Towers/func.c similarity index 100% rename from Home/PL/HW/Hanoi Towers/func.c rename to Homework/Hanoi Towers/func.c diff --git a/Home/PL/HW/Hanoi Towers/gen.c b/Homework/Hanoi Towers/gen.c similarity index 100% rename from Home/PL/HW/Hanoi Towers/gen.c rename to Homework/Hanoi Towers/gen.c diff --git a/Home/PL/HW/Hanoi Towers/head.h b/Homework/Hanoi Towers/head.h similarity index 100% rename from Home/PL/HW/Hanoi Towers/head.h rename to Homework/Hanoi Towers/head.h diff --git a/main/SC/appSC b/Homework/SC/appSC similarity index 100% rename from main/SC/appSC rename to Homework/SC/appSC diff --git a/main/SC/func.c b/Homework/SC/func.c similarity index 100% rename from main/SC/func.c rename to Homework/SC/func.c diff --git a/main/SC/head.h b/Homework/SC/head.h similarity index 100% rename from main/SC/head.h rename to Homework/SC/head.h diff --git a/main/SC/main.c b/Homework/SC/main.c similarity index 100% rename from main/SC/main.c rename to Homework/SC/main.c diff --git a/gen/Trees/appT b/Homework/Trees/appT similarity index 100% rename from gen/Trees/appT rename to Homework/Trees/appT diff --git a/gen/Trees/appTree b/Homework/Trees/appTree similarity index 100% rename from gen/Trees/appTree rename to Homework/Trees/appTree diff --git a/gen/Trees/func.c b/Homework/Trees/func.c similarity index 100% rename from gen/Trees/func.c rename to Homework/Trees/func.c diff --git a/gen/Trees/head.h b/Homework/Trees/head.h similarity index 100% rename from gen/Trees/head.h rename to Homework/Trees/head.h diff --git a/gen/Trees/main.c b/Homework/Trees/main.c similarity index 100% rename from gen/Trees/main.c rename to Homework/Trees/main.c diff --git a/gen/Trees/output/main b/Homework/Trees/output/main similarity index 100% rename from gen/Trees/output/main rename to Homework/Trees/output/main diff --git a/main/arr_xor/appXor b/Homework/arr_xor/appXor similarity index 100% rename from main/arr_xor/appXor rename to Homework/arr_xor/appXor diff --git a/main/arr_xor/func.c b/Homework/arr_xor/func.c similarity index 100% rename from main/arr_xor/func.c rename to Homework/arr_xor/func.c diff --git a/main/arr_xor/head.h b/Homework/arr_xor/head.h similarity index 100% rename from main/arr_xor/head.h rename to Homework/arr_xor/head.h diff --git a/main/arr_xor/main.c b/Homework/arr_xor/main.c similarity index 100% rename from main/arr_xor/main.c rename to Homework/arr_xor/main.c diff --git a/Home/PL/HW/hw04.04/1сonArray.c b/Homework/hw04.04/1сonArray.c similarity index 100% rename from Home/PL/HW/hw04.04/1сonArray.c rename to Homework/hw04.04/1сonArray.c diff --git a/Home/PL/HW/hw04.04/Calculator/function.c b/Homework/hw04.04/Calculator/function.c similarity index 100% rename from Home/PL/HW/hw04.04/Calculator/function.c rename to Homework/hw04.04/Calculator/function.c diff --git a/Home/PL/HW/hw04.04/Calculator/header.h b/Homework/hw04.04/Calculator/header.h similarity index 100% rename from Home/PL/HW/hw04.04/Calculator/header.h rename to Homework/hw04.04/Calculator/header.h diff --git a/Home/PL/HW/hw04.04/Calculator/main.c b/Homework/hw04.04/Calculator/main.c similarity index 100% rename from Home/PL/HW/hw04.04/Calculator/main.c rename to Homework/hw04.04/Calculator/main.c diff --git a/Home/PL/HW/hw04.04/Calculator/main.exe b/Homework/hw04.04/Calculator/main.exe similarity index 100% rename from Home/PL/HW/hw04.04/Calculator/main.exe rename to Homework/hw04.04/Calculator/main.exe diff --git a/Home/PL/HW/hw04.04/Calculator/output/main b/Homework/hw04.04/Calculator/output/main similarity index 100% rename from Home/PL/HW/hw04.04/Calculator/output/main rename to Homework/hw04.04/Calculator/output/main diff --git a/Home/PL/HW/hw04.04/Calculator/output/test.txt b/Homework/hw04.04/Calculator/output/test.txt similarity index 100% rename from Home/PL/HW/hw04.04/Calculator/output/test.txt rename to Homework/hw04.04/Calculator/output/test.txt diff --git a/Home/PL/HW/hw04.04/HanoiTower b/Homework/hw04.04/HanoiTower similarity index 100% rename from Home/PL/HW/hw04.04/HanoiTower rename to Homework/hw04.04/HanoiTower diff --git a/Home/PL/HW/hw04.04/output/1сonArray b/Homework/hw04.04/output/1сonArray similarity index 100% rename from Home/PL/HW/hw04.04/output/1сonArray rename to Homework/hw04.04/output/1сonArray diff --git a/Home/PL/HW/hw04.04/output/2conArray b/Homework/hw04.04/output/2conArray similarity index 100% rename from Home/PL/HW/hw04.04/output/2conArray rename to Homework/hw04.04/output/2conArray diff --git a/Home/PL/HW/hw6/app.exe b/Homework/hw6/app.exe similarity index 100% rename from Home/PL/HW/hw6/app.exe rename to Homework/hw6/app.exe diff --git a/Home/PL/HW/hw6/books.txt b/Homework/hw6/books.txt similarity index 100% rename from Home/PL/HW/hw6/books.txt rename to Homework/hw6/books.txt diff --git a/Home/PL/HW/hw6/func.c b/Homework/hw6/func.c similarity index 100% rename from Home/PL/HW/hw6/func.c rename to Homework/hw6/func.c diff --git a/Home/PL/HW/hw6/gen.c b/Homework/hw6/gen.c similarity index 100% rename from Home/PL/HW/hw6/gen.c rename to Homework/hw6/gen.c diff --git a/Home/PL/HW/hw6/head.h b/Homework/hw6/head.h similarity index 100% rename from Home/PL/HW/hw6/head.h rename to Homework/hw6/head.h diff --git a/main/zero_finder/main.c b/Homework/zero_finder/main.c similarity index 100% rename from main/zero_finder/main.c rename to Homework/zero_finder/main.c diff --git a/main/zero_finder/main.exe b/Homework/zero_finder/main.exe similarity index 100% rename from main/zero_finder/main.exe rename to Homework/zero_finder/main.exe diff --git a/main/HTfromDron/funcst.c b/main/HTfromDron/funcst.c deleted file mode 100644 index db7a83a..0000000 --- a/main/HTfromDron/funcst.c +++ /dev/null @@ -1,219 +0,0 @@ - -#include "lib.h" -#include -#include -#include -#include - -#define max(x, y) (((x) > (y)) ? (x) : (y)) - -void pr(node *tmp) -{ - if (tmp == NULL) - { - printf("[%p]\n", tmp); - return; - } - while (tmp) - { - printf("[%14p]<-[%14p]->[%14p] ", tmp->prev, tmp, tmp->next); - printf("data: [%4ld] s[%s]\n", tmp->data, tmp->s); - tmp = tmp->next; - } - printf("-------------\n"); -} -node *add_head(node *head, int hh) -{ - node *tmp = NULL; - int i; - if ((tmp = malloc(sizeof(node))) == NULL) - { - perror("malloc: NULL"); - exit(2); - } - tmp->prev = NULL; - tmp->data = hh; - for (i = 0; i < N - 1; i++) - tmp->s[i] = ((char)(65 + rand() % 25)); - tmp->s[N - 1] = '\0'; - if (head == NULL) - tmp->next = NULL; - else - { - tmp->next = head; - head->prev = tmp; - } - return tmp; -} -node *del_head(node *head) -{ - node *tmp = head; - if (head == NULL) - return NULL; - if (head->next == NULL) - { - free(head); - return NULL; - } - head = head->next; - head->prev = NULL; - free(tmp); - return head; -} - - -int length(node *list) -{ - node *tmp = list; - int res = 0; - if (list == NULL) - return 0; - if (list->data == 0 && !strcmp(list->s, "\0")) - return 0; - else - { - while (tmp->prev != NULL) - tmp = tmp->prev; - while (tmp != NULL) - { - res++; - tmp = tmp->next; - } - } - return res; -} - -node *adv_add_head(node *head, int hh, char string[]) -{ - node *tmp = NULL; - if ((tmp = malloc(sizeof(node))) == NULL) - { - perror("malloc: NULL"); - exit(2); - } - tmp->prev = NULL; - tmp->data = hh; - memcpy(tmp->s, string, N); - if (head == NULL) - tmp->next = NULL; - else - { - tmp->next = head; - head->prev = tmp; - } - return tmp; -} -void swap(node *a, node *b) -{ - node *tmp = NULL; - if ((tmp = malloc(sizeof(node))) == NULL) - exit(1); - tmp->data = a->data; - a->data = b->data; - b->data = tmp->data; - memcpy(tmp->s, a->s, N); - memcpy(a->s, b->s, N); - memcpy(b->s, tmp->s, N); - free(tmp); -} - -node *get(node *list, int n) -{ - if (n >= length(list)) - exit(3); - int i; - for (i = 0; i < n; i++) - list = list->next; - return list; -} - -node *sort(node *head) -{ - if (head == NULL || head->next == NULL) - return head; - int i, j, n = length(head); - for (i = 0; i < n - 1; i++) - { - for (j = i + 1; j < n; j++) - { - if (get(head, j)->data < get(head, i)->data) - swap(get(head, i), get(head, j)); - } - } - return head; -} -pointer *add_head_address(pointer *head, node **address){ - pointer *tmp = NULL; - if ((tmp = malloc(sizeof(pointer))) == NULL) - { - perror("malloc: NULL"); - exit(2); - } - tmp->address = address; - if (head == NULL) - tmp->next = NULL; - else - { - tmp->next = head; - } - return tmp; -} - -node* printextra(node *head, int len, int i){ - if (len < i || len == 0){ - printf("******************************************|"); - return head; - } - else{ - printf("[%14p] data: [%4ld] s[%s]|", head, head->data, head->s); - return head->prev; - } -} -node *end(node *head){ - node *tmp = NULL; - tmp = head; - if (head == NULL) return head; - while (tmp->next != NULL) tmp = tmp->next; - return tmp; -} - -void printftof(pointer *adresses){ - node *head1 = *(adresses->address), *head2 = *(adresses->next->address), *head3 = *(adresses->next->next->address); - int a = length(head1), b = length(head2), c = length(head3), maximum, i; - maximum = max(max(a,b), c); - head1 = end(head1); - head2 = end(head2); - head3 = end(head3); - for ( i = maximum; i > 0; i--){ - head1 = printextra(head1, a, i); - head2 = printextra(head2, b, i); - head3 = printextra(head3, c, i); - printf("\n"); - } - printf("---------------------------------------------------------------------------------------------------------------------------------\n"); - printf("Tower 1 |Tower 2 |Tower 3 |\n"); - printf("---------------------------------------------------------------------------------------------------------------------------------\n\n"); -} - - -void hanoi_tower(int n, node **head_from, node **head_to, node **head_aux, pointer *adresses){ - if (n == 0) - { - printf("No linked list"); - exit(6); - } - else if (n == 1) - { - if (length(*head_to)==0) printftof(adresses); - *head_to = adv_add_head(*head_to, (*head_from)->data, (*head_from)->s); - *head_from = del_head(*head_from); - if (length(*head_from)==0) printftof(adresses); - return; - } - hanoi_tower(n - 1, head_from, head_aux, head_to, adresses); - printftof(adresses); - *head_to = adv_add_head(*head_to, (*head_from)->data, (*head_from)->s); - *head_from = del_head(*head_from); - printftof(adresses); - hanoi_tower(n - 1, head_aux, head_to, head_from, adresses); -} diff --git a/main/HTfromDron/lib.h b/main/HTfromDron/lib.h deleted file mode 100644 index 2b3645e..0000000 --- a/main/HTfromDron/lib.h +++ /dev/null @@ -1,27 +0,0 @@ -#define N 10 - - -typedef struct Node { - long int data; - struct Node *next; - struct Node *prev; - char s[N]; -} node; -typedef struct nodepointer { - struct nodepointer *next; - struct Node **address; -} pointer; - -void pr(node *tmp); -node *add_head(node *head, int hh); -node *del_head(node *head); -pointer *add_head_address(pointer *head, node **address); -int length(node *list); -node *sort(node *head); -node *get(node *list, int n); -void swap(node *a, node *b); -node *adv_add_head(node *head, int hh, char string[]); -void hanoi_tower(int n, node **head_from, node **head_to, node **head_aux, pointer* adresses); -void printftof(pointer* adresses); -node *end(node *head); -node* printextra(node *head, int len, int i); diff --git a/main/HTfromDron/main.c b/main/HTfromDron/main.c deleted file mode 100644 index 2a7153e..0000000 --- a/main/HTfromDron/main.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "lib.h" -#include -#include -#include -#include - -int main(int argc, char *argv[]){ - - node *head = NULL,*head2 = NULL, *head3 = NULL; - pointer *addresses = NULL; - int r; - - srand(time(NULL)); - - printf("Generated linked list (method of head)\n"); - while ((r=(rand()%100)) < 75) head = add_head(head, r); - pr(head); - - printf("Length of linked list is: %d\n", length(head)); - - printf("Sorted linked list\n"); - sort(head); - pr(head); - addresses = add_head_address(addresses, &head3); - addresses = add_head_address(addresses, &head2); - addresses = add_head_address(addresses, &head); - hanoi_tower(length(head), &head, &head3, &head2, addresses); - return 0; -}