{"id":25490185,"url":"https://github.com/fix2015/structure_linked_list","last_synced_at":"2025-09-01T03:39:38.615Z","repository":{"id":273079277,"uuid":"918646992","full_name":"fix2015/structure_linked_list","owner":"fix2015","description":"A simple implementation of the **Linked List** data structure in JavaScript. This repository demonstrates how to create a linked list class with essential methods and explains its functionality with practical examples.  ","archived":false,"fork":false,"pushed_at":"2025-01-18T13:50:10.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T05:46:28.909Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fix2015.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-18T13:46:16.000Z","updated_at":"2025-01-18T14:41:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"06092c33-86d9-493d-97aa-d71ff3023749","html_url":"https://github.com/fix2015/structure_linked_list","commit_stats":null,"previous_names":["fix2015/structure_linked_list"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fix2015/structure_linked_list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fix2015%2Fstructure_linked_list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fix2015%2Fstructure_linked_list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fix2015%2Fstructure_linked_list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fix2015%2Fstructure_linked_list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fix2015","download_url":"https://codeload.github.com/fix2015/structure_linked_list/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fix2015%2Fstructure_linked_list/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273070345,"owners_count":25040261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-18T21:27:28.162Z","updated_at":"2025-09-01T03:39:38.607Z","avatar_url":"https://github.com/fix2015.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linked List Data Structure in JavaScript 🚀  \n\nA simple implementation of the **Linked List** data structure in JavaScript. This repository demonstrates how to create a linked list class with essential methods and explains its functionality with practical examples.  \n\n---\n\n## What is a Linked List?  \nA **Linked List** is a linear data structure where each element (node) contains a reference (link) to the next element in the sequence. Unlike arrays, linked lists do not require contiguous memory locations. They are made up of nodes that store data and a reference to the next node.  \n\n---\n\n## Features  \n- **Insert**: Add an item to the linked list.  \n- **Delete**: Remove an item from the linked list.  \n- **Search**: Find an item in the linked list.  \n- **Traverse**: Visit each node in the list.  \n- **Size**: Get the number of items in the list.  \n\n---\n\n## Code Implementation  \n\nHere’s the JavaScript implementation of the linked list:  \n\n```javascript\nclass Node {\n    constructor(data) {\n        this.data = data; // Data of the node\n        this.next = null; // Reference to the next node\n    }\n}\n\nclass LinkedList {\n    constructor() {\n        this.head = null; // Start of the linked list\n        this.size = 0; // Number of elements in the list\n    }\n\n    // Insert a new node at the end of the list\n    insert(data) {\n        const newNode = new Node(data);\n        if (this.head === null) {\n            this.head = newNode;\n        } else {\n            let current = this.head;\n            while (current.next !== null) {\n                current = current.next;\n            }\n            current.next = newNode;\n        }\n        this.size++;\n    }\n\n    // Delete the first node containing the given data\n    delete(data) {\n        if (this.head === null) {\n            return \"List is empty!\";\n        }\n        if (this.head.data === data) {\n            this.head = this.head.next;\n            this.size--;\n            return;\n        }\n        let current = this.head;\n        while (current.next !== null \u0026\u0026 current.next.data !== data) {\n            current = current.next;\n        }\n        if (current.next === null) {\n            return \"Data not found!\";\n        }\n        current.next = current.next.next;\n        this.size--;\n    }\n\n    // Search for a node by its data\n    search(data) {\n        let current = this.head;\n        while (current !== null) {\n            if (current.data === data) {\n                return true;\n            }\n            current = current.next;\n        }\n        return false;\n    }\n\n    // Traverse the list and print the data of each node\n    traverse() {\n        let current = this.head;\n        while (current !== null) {\n            console.log(current.data);\n            current = current.next;\n        }\n    }\n}\n```\n\n---\n\n## Example Usage  \n\n```javascript\n// Initialize the linked list\nconst list = new LinkedList();\n\n// Insert items into the list\nlist.insert(\"Node 1\");\nlist.insert(\"Node 2\");\nlist.insert(\"Node 3\");\n\n// Traverse the list\nlist.traverse(); // Output: Node 1, Node 2, Node 3\n\n// Search for an item\nconsole.log(list.search(\"Node 2\")); // Output: true\nconsole.log(list.search(\"Node 4\")); // Output: false\n\n// Delete an item from the list\nlist.delete(\"Node 2\");\nlist.traverse(); // Output: Node 1, Node 3\n\n// Check the size of the list\nconsole.log(list.size); // Output: 2\n```\n\n---\n\n## Real-World Applications  \n1. **Dynamic Memory Allocation**: Used in operating systems for memory management.  \n2. **Database Management**: Linked lists can be used for indexing in databases.  \n3. **Implementing Queues and Stacks**: Used in more complex data structures like queues and stacks.  \n4. **Navigation Systems**: In systems like file explorers, browsers, etc., to track back and forward navigation.  \n\n---\n\n## TikTok Tutorial 🎥  \nWant to see a quick tutorial on how to build this? Check out this TikTok video:  \n[]()  \n\n---\n\n## How to Run the Code  \n1. Clone the repository:  \n   ```bash\n   git clone https://github.com/your-username/linked-list-data-structure.git\n   cd linked-list-data-structure\n   ```\n2. Open the file `linked-list.js` in your favorite code editor.  \n3. Run the file using Node.js:  \n   ```bash\n   node linked-list.js\n   ```\n\n---\n\n## Contributing  \nContributions are welcome! If you have suggestions or want to add new features, feel free to create a pull request.  \n\n---\n\n## License  \nThis project is licensed under the MIT License.  \n\n---\n\n## Connect with Me:\n- [LinkedIn - Vitalii Semianchuk](https://www.linkedin.com/in/vitalii-semianchuk-9812a786/)\n- [Telegram - @jsmentorfree](https://t.me/jsmentorfree) - We do a lot of free teaching on this channel! Join us to learn and grow in web development.\n- [Tiktok - @jsmentoring](https://www.tiktok.com/@jsmentoring) Everyday new videos\n- [Youtube - @jsmentor-uk](https://www.youtube.com/@jsmentor-uk) Mentor live streams\n- [Dev.to - fix2015](https://dev.to/fix2015) Javascript featured, live, experience but about Linked List\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffix2015%2Fstructure_linked_list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffix2015%2Fstructure_linked_list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffix2015%2Fstructure_linked_list/lists"}