Queue

Queue#

class Queue#

Bases: Container, Generic[T]

__init__()#

Methods

__init__()

dequeue()

Remove element from the beginning of the queue.

enqueue(value)

Add element to the end of the queue.

increment_n_ops([increment])

Convenience method to increment n_ops count of the given complexity object.

peek()

Returns the first element of the queue without removing it.

reset_n_ops()

Convenience method to reset n_ops count of the given complexity object.

Attributes

property average_case_delete_time_complexity: str#
Return type:

str

property average_case_insert_time_complexity: str#
Return type:

str

property average_case_search_time_complexity: str#
Return type:

str

property best_case_delete_description: str#
Return type:

str

property best_case_delete_time_complexity: str#
Return type:

str

property best_case_insert_description: str#
Return type:

str

property best_case_insert_time_complexity: str#
Return type:

str

property best_case_search_description: str#
Return type:

str

property best_case_search_time_complexity: str#
Return type:

str

dequeue()#

Remove element from the beginning of the queue.

Returns:

head – Element from the beginning of the queue.

Return type:

Any

enqueue(value)#

Add element to the end of the queue.

Parameters:

value (Any) – Element to add to the queue

Return type:

None

increment_n_ops(increment=1)#

Convenience method to increment n_ops count of the given complexity object.

Return type:

None

property is_empty: bool#
Return type:

bool

property n_ops: int#
Return type:

int

property name: str#
Return type:

str

peek()#

Returns the first element of the queue without removing it.

Returns:

head – Element from the beginning of the queue or None if the queue is empty.

Return type:

Optional[Any]

reset_n_ops()#

Convenience method to reset n_ops count of the given complexity object.

Return type:

None

property size: int#
Return type:

int

property space_complexity: str#
Return type:

str

property worst_case_delete_description: str#
Return type:

str

property worst_case_delete_time_complexity: str#
Return type:

str

property worst_case_insert_description: str#
Return type:

str

property worst_case_insert_time_complexity: str#
Return type:

str

property worst_case_search_description: str#
Return type:

str

property worst_case_search_time_complexity: str#
Return type:

str