Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int del(char* key)
- {
- _Bool ans = 0;
- unsigned int index = hashFunc(key) % SIZE;
- if (strcmp(mas[index]->key, key) == 0)
- {
- scanf("%i", &ans);
- if (ans == 1)
- if (mas[index]->next == NULL)
- return NULL;
- else
- {
- element* temp = mas[index];
- do
- {
- if (strcmp(temp->next->key, key) == 0)
- {
- scanf("%i", &ans);
- if (ans == 1)
- {
- if (temp->next->next == NULL)
- {
- temp->next = NULL;
- return NULL;
- }
- else
- {
- element* temp2;
- do
- {
- if (temp->next == NULL)
- {
- temp = NULL;
- return;
- }
- else
- {
- temp2 = temp->next;
- temp->next = temp->next->next;
- temp->next->next = temp2;
- }
- temp2 = temp2->next;
- } while (1);
- }
- }
- }
- temp = temp->next;
- }while (1);
- }
- }
- else
- {
- element* temp = mas[index];
- do
- {
- if (strcmp(temp->next->key, key) == 0)
- {
- scanf("%i", &ans);
- if (ans == 1)
- {
- if (temp->next->next == NULL)
- {
- temp->next = NULL;
- return NULL;
- }
- else
- {
- element* temp2;
- do
- {
- temp->next = temp->next->next;
- temp2 = temp->next->next;
- if (temp2->next == NULL)
- return NULL;
- temp2 = temp2->next;
- } while (1);
- }
- }
- }
- temp = temp->next;
- } while (1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement