O’Reilly Media, Inc., 2021. — 282 p. — ISBN 978-1-492-09106-6.
When it comes to writing efficient code, every software professional needs to have an effective working knowledge of algorithms. In this practical book, author George Heineman (Algorithms in a Nutshell) provides concise and informative descriptions of key algorithms that improve coding in multiple languages. Software developers, testers, and maintainers will discover how algorithms solve computational problems creatively.
Each chapter builds on earlier chapters through eye-catching visuals and a steady rollout of essential concepts, including an algorithm analysis to classify the performance of every algorithm presented in the book. At the end of each chapter, you will get to apply what you have learned to a novel challenge problem simulating the experience you might find in a technical code interview.
With this book, you willExamine fundamental algorithms central to computer science and software engineering
Learn common strategies for efficient problem solving such as divide and conquer, dynamic programming, and greedy approaches
Analyze code to evaluate time complexity using big O notation
Use existing Python libraries and data structures to solve problems using algorithms
Understand the main steps of important algorithms
True PDFForeword
Problem SolvingWhat Is an Algorithm?
Finding the Largest Value in an Arbitrary List
Counting Key Operations
Models Can Predict Algorithm Performance
Find Two Largest Values in an Arbitrary List
Tournament Algorithm
Time Complexity and Space Complexity
Challenge Exercises
Analyzing AlgorithmsUsing Empirical Models to Predict Performance
Multiplication Can Be Faster
Performance Classes
Asymptotic Analysis
Counting All Operations
Counting All Bytes
When One Door Closes, Another One Opens
Binary Array Search
Almost as Easy as π
Two Birds with One Stone
Pulling It All Together
Curve Fitting Versus Lower and Upper Bounds
Challenge Exercises
Better Living Through Better HashingAssociating Values with Keys
Hash Functions and Hash Codes
A Hashtable Structure for (Key, Value) Pairs
Detecting and Resolving Collisions with Linear Probing
Separate Chaining with Linked Lists
Removing an Entry from a Linked List
Evaluation
Growing Hashtables
Analyzing the Performance of Dynamic Hashtables
Perfect Hashing
Iterate Over (key, value) Pairs
Challenge Exercises
Heaping It OnMax Binary Heaps
Inserting a (value, priority)
Removing the Value with Highest Priority
Representing a Binary Heap in an Array
Implementation of Swim and Sink
Challenge Exercises
Sorting Without a HatSorting by Swapping
Selection Sort
Anatomy of a Quadratic Sorting Algorithm
Analyze Performance of Insertion Sort and Selection Sort
Recursion and Divide and Conquer
Merge Sort
Quicksort
Heap Sort
Performance Comparison of O(N log N) Algorithms
Tim Sort
Challenge Exercises
Binary Trees: Infinity in the Palm of Your HandGetting Started
Binary Search Trees
Searching for Values in a Binary Search Tree
Removing Values from a Binary Search Tree
Traversing a Binary Tree
Analyzing Performance of Binary Search Trees
Self-Balancing Binary Trees
Analyzing Performance of Self-Balancing Trees
Using Binary Tree as (key, value) Symbol Table
Using the Binary Tree as a Priority Queue
Challenge Exercises
Graphs: Only Connect!Graphs Efficiently Store Useful Information
Using Depth First Search to Solve a Maze
Breadth First Search Offers Different Searching Strategy
Directed Graphs
Graphs with Edge Weights
Dijkstra’s Algorithm
All-Pairs Shortest Path
Floyd–Warshall Algorithm
Challenge Exercises
Wrapping It UpPython Built-in Data Types
Implementing Stack in Python
Implementing Queues in Python
Heap and Priority Queue Implementations
Future Exploration