class Graphlb::DataStructures::Queue(A)

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

Initializes the Queue with empty array


[View source]

Instance Method Detail

def empty? #

returns true if the Queue is empty


[View source]
def pop #

pops the value that is first inserted

@return : first element inserted


[View source]
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


[View source]
def top #

returns the first-most element in the queue without deleting it


[View source]
def values #

returns all the values that are present in the Queue


[View source]