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

 
 
 

Contributors

Languages