class Graphlb::DataStructures::Queue(A)
- Graphlb::DataStructures::Queue(A)
- Reference
- Object
Overview
In crystal, elements in an array are added in dynamics fashion means the size of the array is not fixed which makes them quite similar to linked list.
Here we have implemented the Queue Data Structure using an Array. A Queue follows First-in-First-out.
Defined in:
graphlb/data_structures/queue.crConstructors
-
.new
Initializes the Queue with empty array
Instance Method Summary
-
#empty?
returns true if the Queue is empty
-
#pop
pops the value that is first inserted
-
#push(val)
pushes the value present inside the val into the queue
-
#top
returns the first-most element in the queue without deleting it
-
#values
returns all the values that are present in the Queue
Constructor Detail
Instance Method Detail
def push(val)
#
pushes the value present inside the val into the queue
@param : val , the value we want to append into the queue
@return : returns the array of elements in the queue