Ultimate Python
/
Python Versions
Fundamentals(11)
  • Variable
  • Expression
  • String
  • List
  • Tuple
  • Set
  • Dict
  • Conditional
  • Loop
  • Function
  • Comprehension
OOP(11)
  • Basic Class
  • Dataclass
  • Inheritance
  • Encapsulation
  • Property
  • Enum
  • Abstract Class
  • Exception Class
  • Iterator Class
  • Mixin
  • Mro
Data Structures(5)
  • Deque
  • Namedtuple
  • Ordereddict
  • Defaultdict
  • Heap
Standard Library(5)
  • File Handling
  • Regex
  • Data Format
  • Date Time
  • Itertools
Advanced(9)
  • Decorator
  • Context Manager
  • Meta Class
  • Weak Ref
  • Walrus Operator
  • Arg Enforcement
  • Dict Union
  • Pattern Matching
  • Template Strings
Concurrency(4)
  • Thread
  • Process
  • Async
  • Subinterpreters
Engineering(5)
  • Mocking
  • Benchmark
  • Memory Profile
  • Logger
  • Bitwise

No matching lessons found

Chapter5 Lessons

Data Structures

Specialized collections and algorithmic data structures. Master double-ended queues, immutable named records, specialized dictionaries, and min/max priority heaps.

Start Chapter: Deque

Chapter Lessons

01

Deque

A double-ended queue (`collections.deque`) is a sequence-like container designed for fast, O(1) time complexity insertions and deletions from both ends.

View Code
02

Namedtuple

A named tuple (`collections.namedtuple`) is a factory function for creating tuple subclasses with named fields.

View Code
03

Ordereddict

An `OrderedDict` (`collections.OrderedDict`) remembers the order in which entries were added, like a regular `dict`. Its distinguishing feature is that it also provides methods for changing and removing entries by their position.

View Code
04

Defaultdict

A `collections.defaultdict` is a subclass of the built-in dictionary (`dict`) that automatically initializes missing keys with a default value.

View Code
05

Heap

A heap is a specialized tree-based data structure that satisfies the heap property: in a min-heap, every parent node is smaller than or equal to its children, while in a max-heap, every parent is greater than or equal to its children.

View Code
Previous ChapterOOPNext ChapterStandard Library