TP1: Presentation

This commit is contained in:
augustin64 2024-03-31 18:26:34 +02:00
parent ce8fd5f3a5
commit ecef2540bc

View File

@ -29,7 +29,7 @@ void insertFirst(linkedList *list, int key, void *data) {
//delete first item
node* deleteFirst(linkedList *list) {
if (list->head == NULL) {
if (!list->head) {
return NULL;
}
@ -50,7 +50,7 @@ node* find(linkedList *list, int key) {
node* current = list->head;
//if list is empty
if(list->head == NULL) {
if(!current) {
return NULL;
}
@ -58,7 +58,7 @@ node* find(linkedList *list, int key) {
while(current->key != key) {
//if it is last node
if(current->next == NULL) {
if(!current->next) {
return NULL;
} else {
//go to next link
@ -78,7 +78,7 @@ node* deleteElement(linkedList *list, int key) {
node* previous = NULL;
//if list is empty
if(list->head == NULL) {
if(!list->head) {
return NULL;
}
@ -86,7 +86,7 @@ node* deleteElement(linkedList *list, int key) {
while(current->key != key) {
//if it is last node
if(current->next == NULL) {
if(!current->next) {
return NULL;
} else {
//store reference to current link
@ -110,7 +110,7 @@ node* deleteElement(linkedList *list, int key) {
//is list empty
bool isEmpty(linkedList *list) {
return list->head == NULL;
return !list->head;
}
int length(linkedList *list) {