Understanding LinkedList Data Structure in Rubyby@yair
662 reads

Understanding LinkedList Data Structure in Ruby

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

In this article, we will create a singly LinkedList from scratch and explain how this data structure works and what it is useful for. The Big O time complexity to retrieve elements is 0(n) In a linked list, we can not retrieve an element by its index like in arrays. This is similar to an array because we can use both to store linear data. Linked lists need less space in memory than arrays and are dynamic and can expand its size. We will start by adding the add_first method to add a new element to our Linked list.

Coin Mentioned

Mention Thumbnail
featured image - Understanding LinkedList Data Structure in Ruby
Yair HackerNoon profile picture

@yair

Yair

Receive Stories from @yair

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!