Module: Algorithmable::DataStructs

Includes:
LinkedList, Tree
Included in:
Cups::StacksAndQueues::StackSorter, Cups::StacksAndQueues::TowersOfHanoi::Tower, Cups::StacksAndQueues::TwoStacksQueue, Tree::Binary, Tree::BinarySearch, Puzzles::DijkstrasTwoStacks, Puzzles::JosephusProblem
Defined in:
lib/algorithmable/data_structs.rb,
lib/algorithmable/data_structs/bag.rb,
lib/algorithmable/data_structs/heap.rb,
lib/algorithmable/data_structs/tree.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/tree/binary.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/tree/binary_search.rb,
lib/algorithmable/data_structs/ordered_symbol_table.rb

Defined Under Namespace

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

Instance Method Summary collapse

Methods included from Tree

#new_ordered_binary_tree

Methods included from LinkedList

#new_doubly_linked_list, #new_singly_linked_list

Instance Method Details

#new_bagObject


15
16
17
# File 'lib/algorithmable/data_structs.rb', line 15

def new_bag
  Bag.new
end

#new_deque_queueObject


27
28
29
# File 'lib/algorithmable/data_structs.rb', line 27

def new_deque_queue
  Deque.new
end

#new_fifo_queueObject


19
20
21
# File 'lib/algorithmable/data_structs.rb', line 19

def new_fifo_queue
  Queue.new
end

#new_lifo_queueObject


23
24
25
# File 'lib/algorithmable/data_structs.rb', line 23

def new_lifo_queue
  Stack.new
end

#new_max_priority_queue(collection = []) ⇒ Object


39
40
41
# File 'lib/algorithmable/data_structs.rb', line 39

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

#new_min_priority_queue(collection = []) ⇒ Object


43
44
45
# File 'lib/algorithmable/data_structs.rb', line 43

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

#new_ordered_symbol_table(key_type, value_type) ⇒ Object


31
32
33
# File 'lib/algorithmable/data_structs.rb', line 31

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

#new_priority_queue(collection, &block) ⇒ Object


35
36
37
# File 'lib/algorithmable/data_structs.rb', line 35

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