Lab8_LinkedListOperations
Lab8_LinkedListOperations
#include <stdio.h>
#include <stdlib.h>
// Node structure
struct Node {
int data;
struct Node* next;
};
int main() {
struct Node* head = NULL;
append(&head, 10);
append(&head, 20);
append(&head, 30);
printf("Linked List after insertions: ");
display(head);
deleteByValue(&head, 20);
printf("Linked List after deletion: ");
display(head);
return 0;
}
1. Insertion Results
- Description: After adding nodes with values 10, 20, and 30, the Linked List displays all
nodes in order. This demonstrates the appending operation, showing the new nodes added
at the end of the list.
2. Deletion Results
- Description: Shows the Linked List after deleting the node with value 20. Only the
specified node is removed, and the remaining nodes are correctly linked.
3. Traversal Results
- Description: Displays the entire Linked List in sequence. This confirms the structure is
intact, and all nodes can be accessed sequentially.
3. Algorithm Write-up