https://github.com/jonathanyiv/linked_list
Implementation of Linked Lists in Ruby
https://github.com/jonathanyiv/linked_list
linked-list ruby
Last synced: 24 days ago
JSON representation
Implementation of Linked Lists in Ruby
- Host: GitHub
- URL: https://github.com/jonathanyiv/linked_list
- Owner: JonathanYiv
- Created: 2017-08-20T15:42:08.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-20T21:04:18.000Z (almost 9 years ago)
- Last Synced: 2025-02-26T05:33:22.984Z (over 1 year ago)
- Topics: linked-list, ruby
- Language: Ruby
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Linked List Project
This is my version of implementing the data structure [linked lists](https://en.wikipedia.org/wiki/Linked_list) in ruby.
This is a project from [The Odin Project](https://www.theodinproject.com/courses/ruby-programming/lessons/linked-lists).

## Installation
Open your Terminal/Command Line. Navigate to the directory where your version will live. Type in the following:
```
$ git clone https://github.com/JonathanYiv/linked_list.git
$ cd linked_list
$ ruby linkedlist.rb
```
### Available Methods
```
#append(data) appends the data to the end of the list
#prepend(data) prepends the data to the start of the list
#size returns the total number of nodes in the list
#head returns the first node in the list
#tail returns the last node in the list
#at(index) returns the node at the given index
#pop removes the last node from the list
#contains?(data) returns true if the value is in the list
#find(data) returns the index of the data
#to_s represents the linked list as a string
#insert_at(index) lets you insert data at a given index
#remove_at(index) lets you remove the node at a given index
```
## Pre-Project Thoughts
Odin has been having me go through various types of data structures and algorithms.
I find them really fascinating and definitely have a gap of knowledge regarding them.
Implementing Linked Lists will be beneficial for me to understand how a data structure is built.
## Post-Project Thoughts
This was definitely one of the more fun projects. In hindsight, there was a lot of redundancy in traversing the linked list. Later on, I may refactor with a #traverse method that accepts a condition block.