Skip to content
UPEEC

Data Structures and Algorithms

collections, heapq, bisect, array, copy, enum and itertools/functools/operator.

Easy
Comments 0

This is an overview — pick a sub-topic below.

Sub-topics (10)

collections

Specialised containers: Counter, defaultdict, deque, namedtuple, OrderedDict and ChainMap.

Easy♥ 0🔖 0💬 0

heapq

A binary min-heap on top of a list — priority queues in O(log n).

Easy♥ 0🔖 0💬 0

bisect

Binary search and sorted insertion on sorted lists.

Easy♥ 0🔖 0💬 0

array

Compact arrays of a single numeric type (much smaller than lists of ints).

Easy♥ 0🔖 0💬 0

copy

Shallow and deep copies of objects.

Easy♥ 0🔖 0💬 0

pprint

Pretty-prints nested data structures in a readable layout.

Beginner♥ 0🔖 0💬 0

enum

Named constants grouped into a type.

Easy♥ 0🔖 0💬 0

itertools

Fast iterator building blocks: count, cycle, chain, product, permutations, combinations, groupby, accumulate, islice, pairwise and more.

Intermediate♥ 0🔖 0💬 0

functools

Tools for functions: lru_cache, cache, partial, reduce, wraps, singledispatch, total_ordering, cached_property.

Intermediate♥ 0🔖 0💬 0

operator

Function versions of operators (add, mul, itemgetter, attrgetter) for use with map, sorted and reduce.

Intermediate♥ 0🔖 0💬 0

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.