Native Arrays and Array Lists
- Let's talk about native arrays vs. Ruby arrays (
ArrayList
in Java) - 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
- together:
Array Lists vs Linked Lists
- Let's talk about linked lists
- 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
- provided:
Interfaces vs Implementations
- Let's look at
lotto.rb
and talk about interfaces vs implementations - Let's make it so that lotto ticket numbers are always displayed in numerical order. Do this by modifying the
add(value)
method inArrayList
- Do the same for
add(value)
method inLinkedList