Skip to content

About

Here in Linked List All Item Included that mean Insert_at_beginning, Insert_From_End, PopFromBeginning, Pop From End, Count Linked List, Printing All Linked List Data

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Singly Linked List Implementation in Python

This project implements a Singly Linked List in Python. It includes functionalities such as inserting and removing nodes at both the beginning and the end, inserting at a specific index, counting nodes, and printing the entire list in a readable format.

Features

  • Insert at Beginning: Adds a node to the start of the list.
  • Insert at End: Adds a node to the end of the list.
  • Insert at Index: Inserts a node at a specific index.
  • Pop from Beginning: Removes the first node and returns its value.
  • Pop from End: Removes the last node and returns its value.
  • Count Nodes: Returns the total number of nodes in the list.
  • Print List: Prints the linked list in a human-readable format.

Class Methods

  • Insert_At_Beginning(Value) Inserts a new node with the given Value at the beginning of the list.

  • Insert_At_End(Value) Inserts a new node with the given Value at the end of the list.

  • Insert_At_index(index, Value) Inserts a new node with the given Value at the specified index.

  • Pop_From_Beginning() Removes and returns the value of the first node in the list.

  • Pop_From_End() Removes and returns the value of the last node in the list.

  • Count_LinkedList() Returns the total number of nodes in the linked list.

  • Print_Linked_List() Prints the entire linked list in a human-readable format like: Value1 ===> Value2 ===> Value3

How to Use

1.Clone the repository:

git clone https://github.com/yourusername/LinkedList

2.Run the Python script:

python linked_list.py

Example Usage

LL1 = LinkedList()

# Insert at Beginning
LL1.Insert_At_Beginning(10)
LL1.Insert_At_Beginning(15)
LL1.Print_Linked_List()

# Insert at End
LL1.Insert_At_End(30)
LL1.Print_Linked_List()

# Pop from End
LL1.Pop_From_End()
LL1.Print_Linked_List()

# Count Nodes
print(f"Total Nodes: {LL1.Count_LinkedList()}")

License

This project is licensed under the MIT License.

About

Here in Linked List All Item Included that mean Insert_at_beginning, Insert_From_End, PopFromBeginning, Pop From End, Count Linked List, Printing All Linked List Data

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages