Skip to content

Comparing List interfaces implemented with Array vs Linked Nodes

Notifications You must be signed in to change notification settings

AdaGold/list-implementations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

List Implementations

Native Arrays and Array Lists

  1. Let's talk about native arrays vs. Ruby arrays (ArrayList in Java)
  2. Let's write lib/array_list.rb where we will simulate what happens "under the hood" with Ruby's Array object.
    • together: initialize, add, delete, to_s, include?, size
    • on your own: max

Array Lists vs Linked Lists

  1. Let's talk about linked lists
  2. Let's take look at lib/linked_list.rb and see how the implementation is different (but the interface is the same) and uses nodes instead of a native array to store data.
    • provided: Node class, LinkedList class: initialize, add, delete, to_s
    • together: include?, size
    • on your own: max

Interfaces vs Implementations

  1. Let's look at lotto.rb and talk about interfaces vs implementations
  2. Let's make it so that lotto ticket numbers are always displayed in numerical order. Do this by modifying the add(value) method in ArrayList
  3. Do the same for add(value) method in LinkedList

About

Comparing List interfaces implemented with Array vs Linked Nodes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published