pyDS package

Submodules

pyDS.linked_list module

class pyDS.linked_list.LinkedList[source]

Bases: object

An implementation of the Linked List data structure.

append(item)[source]

Add item to the end of the Linked List.

Args:
item: The item to be inserted.
delete(item)[source]

Delete an item from the Linked List.

push(item)[source]

Add item to the front of the Linked List.

Args:
item: The item to be inserted.
reverse()[source]

Reverse the items of the Linked List.

class pyDS.linked_list.Node(data)[source]

Bases: object

Building Block of Linked List.

pyDS.queue module

class pyDS.queue.Queue[source]

Bases: object

An implementation of the Queue data strucutre.

dequeue()[source]

Remove item from queue.

Returns:
The first item from the Queue. Raises IndexError if Queue empty.
enqueue(item)[source]

Add item to Queue.

Args:
item: The item to be inserted.
front()[source]

Return the first Queue item.

Returns:
The first item from the Queue. Raises IndexError if Queue empty.
is_empty()[source]

Check queue is empty.

Returns:
True if Queue is empty, False otherwise.
rear()[source]

Return the last Queue item.

Returns:
The last item from the Queue. Raises IndexError if Queue empty.

pyDS.stack module

class pyDS.stack.Stack[source]

Bases: object

An implementation of the stack data structure.

is_empty()[source]

Return whether the stack is empty.

peek()[source]

Return the top item from the Stack.

pop()[source]

Remove an item from the Stack.

push(item)[source]

Add an item to the stack.

Module contents