Delete Leak, Task 10 is workgit add .!

This commit is contained in:
AZEN-SGG 2025-05-20 19:19:17 +03:00
parent 651cc5c7d9
commit bccb0a6617
44 changed files with 12 additions and 1124 deletions

View file

@ -1,56 +0,0 @@
#include "solve_10.h"
#include "node.h"
#include "io_node.h"
#include <string.h>
#include <stdlib.h>
node * t10_solve (node *head)
{
int down = 0;
node *last, *curr, *next,
*start;
last=next=start=NULL;
curr = head;
for (next=curr->next; next; next=curr->next)
{
if (strcmp(next->string, curr->string) <= 0) {
if (!down)
start = last;
down++;
} else {
if (down) {
if (start) {
delete_nodes(start->next, down+1);
start->next = next;
last = start;
} else {
delete_nodes(head, down+1);
head = next;
last = NULL;
}
curr = NULL;
}
down = 0;
}
last = curr;
curr = next;
}
if (down) {
if (start) {
delete_nodes(start->next, down+1);
start->next = NULL;
} else {
delete_nodes(head, down+1);
head = NULL;
}
curr = NULL;
last = NULL;
}
return head;
}