amzlist Package

amzlist Package

class amzlist.__init__.LinkedList(strict=None)

Bases: object

A LinkedList implementation.

append(node)

Inserts node at the tail of the LinkedList.

as_list()

Returns this LinkedList as a list of Nodes.

data

Returns the data for the first Node.

find(node, inc_prev=None)

Find the specified Node.

If the node parameter is a Node, and it has data and a next Node then the first Node with encountered that has the same data and next attribute values will match.

If the node parameter is a value other than a Node or a Node with just a data attribute value, then the first node encountered with the same data attribute value will match.

If inc_prev is True, this method returns the node and it’s previous node in a tuple, otherwise it returns the node.

This method returns None if the node cannot be found.

insert(node, after)

Inserts node and makes after.next refer to it.

last_node

Returns the last Node.

next

Returns the next Node.

pop()

Returns the Node from the head, and removes it.

prepend(node)

Inserts node at the head of the LinkedList.

push(node)

Prepends a Node to the head.

remove(node)

Remove the specified node.

If the node parameter is a Node, and it has data and a next Node then the first Node with encountered that has the same data and next attribute values will be removed.

If the node parameter is a value other than a Node or a Node with just a data attribute value, then the first node encountered with the same data attribute is removed.

reverse_iterative()

Returns a new LinkedList with the Nodes in reverse order.

This method uses an iterative approach.

reverse_recursive(node=None, new_list=None)

Returns a new LinkedList with the Nodes in reverse order.

This method uses a recursive approach.

class amzlist.__init__.Node(data)

Bases: object

A Node is a simple object with two attributes, next and data.

data stores a value, and next holds a reference to another Node.

data = None

Data text

next = None

Next text

strict = False

Project Versions

Table Of Contents

Previous topic

amzlist

This Page