Module: Algorithmable::DataStructs

Includes:
LinkedList
Included in:
Puzzles::DijkstrasTwoStacks, Puzzles::JosephusProblem, Sort::BinaryHeap
Defined in:
lib/algorithmable/data_structs.rb,
lib/algorithmable/data_structs/bag.rb,
lib/algorithmable/data_structs/heap.rb,
lib/algorithmable/data_structs/deque.rb,
lib/algorithmable/data_structs/queue.rb,
lib/algorithmable/data_structs/stack.rb,
lib/algorithmable/data_structs/heap/imp.rb,
lib/algorithmable/data_structs/heap/max.rb,
lib/algorithmable/data_structs/heap/min.rb,
lib/algorithmable/data_structs/linked_list.rb,
lib/algorithmable/data_structs/linked_list/base.rb,
lib/algorithmable/data_structs/linked_list/doubly.rb,
lib/algorithmable/data_structs/linked_list/singly.rb,
lib/algorithmable/data_structs/ordered_symbol_table.rb

Defined Under Namespace

Modules: Heap, LinkedList Classes: Bag, Deque, OrderedSymbolTable, Queue, Stack

Instance Method Summary collapse

Methods included from LinkedList

#new_doubly_linked_list, #new_singly_linked_list

Instance Method Details

#new_bagObject



13
14
15
# File 'lib/algorithmable/data_structs.rb', line 13

def new_bag
  Bag.new
end

#new_fifo_queueObject



17
18
19
# File 'lib/algorithmable/data_structs.rb', line 17

def new_fifo_queue
  Queue.new
end

#new_lifo_queueObject



21
22
23
# File 'lib/algorithmable/data_structs.rb', line 21

def new_lifo_queue
  Stack.new
end

#new_max_priority_queue(collection = []) ⇒ Object



33
34
35
# File 'lib/algorithmable/data_structs.rb', line 33

def new_max_priority_queue(collection = [])
  Heap::Max.new(collection)
end

#new_min_priority_queue(collection = []) ⇒ Object



37
38
39
# File 'lib/algorithmable/data_structs.rb', line 37

def new_min_priority_queue(collection = [])
  Heap::Min.new(collection)
end

#new_ordered_symbol_table(key_type, value_type) ⇒ Object



25
26
27
# File 'lib/algorithmable/data_structs.rb', line 25

def new_ordered_symbol_table(key_type, value_type)
  OrderedSymbolTable.new(key_type, value_type)
end

#new_priority_queue(collection, &block) ⇒ Object



29
30
31
# File 'lib/algorithmable/data_structs.rb', line 29

def new_priority_queue(collection, &block)
  Heap::Max.new(collection, &block)
end