Home Page Icon
Home Page
Table of Contents for
Titlepage
Close
Titlepage
by Bradford Tuckfield
Dive Into Algorithms
Cover
Titlepage
Copyright
Dedication
About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Who Is This Book For?
About This Book
Setting Up the Environment
Install Python on Windows
Install Python on macOS
Install Python on Linux
Installing Third-Party Modules
Summary
Chapter 1: Problem-Solving With Algorithms
The Analytic Approach
The Galilean Model
The Solve-for-x Strategy
The Inner Physicist
The Algorithmic Approach
Thinking with Your Neck
Applying Chapman’s Algorithm
Solving Problems with Algorithms
Summary
Chapter 2: Algorithms in History
Russian Peasant Multiplication
Doing RPM by Hand
Implementing RPM in Python
Euclid’s Algorithm
Doing Euclid’s Algorithm by Hand
Implementing Euclid’s Algorithm in Python
Japanese Magic Squares
Creating the Luo Shu Square in Python
Implementing Kurushima's Algorithm in Python
Summary
Chapter 3: Maximizing and Minimizing
Setting Tax Rates
Steps in the Right Direction
Turning the Steps into an Algorithm
Objections to Gradient Ascent
The Problem of Local Extrema
Education and Lifetime Income
Climbing the Education Hill—the Right Way
From Maximization to Minimization
Hill Climbing in General
When Not to Use an Algorithm
Summary
Chapter 4: Sorting and Searching
Insertion Sort
Putting the Insertion in Insertion Sort
Sorting via Insertion
Measuring Algorithm Efficiency
Why Aim for Efficiency?
Measuring Time Precisely
Counting Steps
Comparing to Well-Known Functions
Adding Even More Theoretical Precision
Using Big O Notation
Merge Sort
Merging
From Merging to Sorting
Sleep Sort
From Sorting to Searching
Binary Search
Applications of Binary Search
Summary
Chapter 5: Pure Math
Continued Fractions
Compressing and Communicating Phi
More about Continued Fractions
An Algorithm for Generating Continued Fractions
From Decimals to Continued Fractions
From Fractions to Radicals
Square Roots
The Babylonian Algorithm
Square Roots in Python
Random Number Generators
The Possibility of Randomness
Linear Congruential Generators
Judging a PRNG
The Diehard Tests for Randomness
Linear Feedback Shift Registers
Summary
Chapter 6: Advanced Optimization
Life of a Salesman
Setting Up the Problem
Brains vs. Brawn
The Nearest Neighbor Algorithm
Implementing Nearest Neighbor Search
Checking for Further Improvements
Algorithms for the Avaricious
Introducing the Temperature Function
Simulated Annealing
Tuning Our Algorithm
Avoiding Major Setbacks
Allowing Resets
Testing Our Performance
Summary
Chapter 7: Geometry
The Postmaster Problem
Triangles 101
Advanced Graduate-Level Triangle Studies
Finding the Circumcenter
Increasing Our Plotting Capabilities
Delaunay Triangulation
Incrementally Generating Delaunay Triangulations
Implementing Delaunay Triangulations
From Delaunay to Voronoi
Summary
Chapter 8: Language
Why Language Algorithms Are Hard
Space Insertion
Defining a Word List and Finding Words
Dealing with Compound Words
Checking Between Existing Spaces for Potential Words
Using an Imported Corpus to Check for Valid Words
Finding First and Second Halves of Potential Words
Phrase Completion
Tokenizing and Getting N-grams
Our Strategy
Finding Candidate n + 1-grams
Selecting a Phrase Based on Frequency
Summary
Chapter 9: Machine Learning
Decision Trees
Building a Decision Tree
Downloading Our Dataset
Looking at the Data
Splitting Our Data
Smarter Splitting
Choosing Splitting Variables
Adding Depth
Evaluating Our Decision Tree
The Problem of Overfitting
Improvements and Refinements
Random Forests
Summary
Chapter 10: Artificial Intelligence
La Pipopipette
Drawing the Board
Representing Games
Scoring Games
Game Trees and How to Win a Game
Building Our Tree
Winning a Game
Adding Enhancements
Summary
Chapter 11: Forging Ahead
Doing More with Algorithms
Building a Chatbot
Text Vectorization
Vector Similarity
Becoming Better and Faster
Algorithms for the Ambitious
Solving the Deepest Mysteries
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Beyond the Basic Stuff with Python
Next
Next Chapter
Copyright
Dive into Algorithms
A Pythonic Adventure for the Intrepid Beginner
Bradford Tuckfield
San Francisco
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset