Skip to content

zaiinbaloch/linklist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Linked List Implementation in C++

πŸš€ Overview This is a C++ program that implements a Singly Linked List with the following functionalities: Insert nodes at the tail (end of the list). Display the current list . Delete a node by specific value . Provides an interactive menu driven approach for user input.

πŸ“Œ Features βœ… Insert elements at the end of the linked list . βœ… Delete a specific element from the list. βœ… Display the linked list in the format: 10 > 20 > 30 > NULL βœ… Handles cases like: Deleting the head node . Deleting a middle or last node . Trying to delete a non existent value . Deleting from an empty list . βœ… User friendly menu based interaction. βœ… Screen clearing (system("cls")) for a cleaner interface.

./linkedlist πŸ–₯️ Program Menu Once you run the program, you will see:

Enter A to insert value in link list Enter B to display values of link list Enter C to delete a value from the link list βœ… Insertion

Enter a Number you want to enter in the link list: 10 Do you want to enter another number? (Enter 'y'/'n'): y Enter a Number you want to enter in the link list: 20 Do you want to enter another number? (Enter 'y'/'n'): n βœ… Displaying List rust

10 > 20 > 30 > NULL βœ… Deleting an Element

Enter a Number you want to delete from the link list: 20 Node with value 20 has been deleted. Updated Linked List: 10 > 30 > NULL πŸ”„ Functions Explanation πŸ”Ή Insert at Tail (tail(int d)) Adds a new node at the end of the list. If the list is empty, the new node becomes head. πŸ”Ή Delete a Node (del(int target)) Searches for the target value. If found: Updates the previous node's next pointer. Deletes the target node from memory. If the target is not found, prints "Value not found in list". πŸ”Ή Display (display()) Traverses the linked list and prints values. πŸ’» Example Execution

Enter A to insert value in link list Enter B to display values of link list Enter C to delete a value of link list A Enter a Number you want to enter in the link list: 5 Do you want to enter another number? (Enter 'y'/'n'): y Enter a Number you want to enter in the link list: 15 Do you want to enter another number? (Enter 'y'/'n'): n B 5 > 15 > NULL C Enter a Number you want to delete from the link list: 5 Node with value 5 has been deleted Updated Linked List: 15 > NULL ⚑ Author πŸ‘€ Zain ul Abidin πŸ“§ Contact: https://github.com/zaiinbaloch

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages