Inspiration
I was inspired to implement a linked list data structure from scratch as a way to deepen my understanding of computer science fundamentals and data structures. Linked lists are widely used in many applications and have a lot of practical uses, so I wanted to gain hands-on experience in building them.
What it does
The project consists of two classes: Node and LinkedList. The Node class defines the structure of a node in the linked list, which contains a data field and a reference to the next node in the list. The LinkedList class implements various operations that can be performed on linked lists, such as adding a new node to the list, deleting a node, finding the length of the list, and displaying the elements of the list.
How I built it
I started by defining the Node class and its constructor, which initializes a node with a data field and sets the next reference to None. Then I implemented the LinkedList class, which has an instance variable head that points to the first node in the list. I added various methods to the LinkedList class, such as append, prepend, insert_after_node, delete_node, delete_node_at_pos, len_iterative, len_recursive, and display. Each method implements a different operation that can be performed on a linked list.
Challenges I ran into
One of the challenges I faced while building the project was understanding how to traverse the linked list and keep track of the previous and current nodes while performing various operations.
Accomplishments that I'm proud of
I am proud of successfully implementing a linked list from scratch and gaining a deeper understanding of this important data structure. I am also proud of being able to implement various operations on linked lists, such as adding and deleting nodes and finding the length of the list both iteratively and recursively.
What I learned
Through this project, I learned how linked lists are structured and how they are implemented in code. I also learned how to perform various operations on linked lists, such as adding and deleting nodes and finding the length of the list both iteratively and recursively. This project helped me understand the fundamental concepts of linked lists and how they are used in real-world applications.
What's next for Implement a Data Structure
I plan to extend the project by adding more advanced operations on linked lists, such as reversing a linked list, merging two linked lists, and implementing a linked list as a stack or queue, to further my understanding of linked lists.
Log in or sign up for Devpost to join the conversation.