ebook img

Learning Algorithms PDF

2.54 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learning Algorithms

Foreword Page: 4 Preface Page: 5 Who This Book Is For Page: 5 About the Code Page: 5 Conventions Used in This Book Page: 6 O’Reilly Online Learning Page: 6 How to Contact Us Page: 6 Acknowledgments Page: 6 1. Problem Solving Page: 7 What Is an Algorithm? Page: 7 Finding the Largest Value in an Arbitrary List Page: 8 Counting Key Operations Page: 8 Models Can Predict Algorithm Performance Page: 8 Find Two Largest Values in an Arbitrary List Page: 10 Tournament Algorithm Page: 11 Time Complexity and Space Complexity Page: 13 Summary Page: 14 Challenge Exercises Page: 14 2. Analyzing Algorithms Page: 15 Using Empirical Models to Predict Performance Page: 15 Multiplication Can Be Faster Page: 16 Performance Classes Page: 16 Asymptotic Analysis Page: 17 Counting All Operations Page: 18 Counting All Bytes Page: 18 When One Door Closes, Another One Opens Page: 19 Binary Array Search Page: 19 Almost as Easy as π Page: 19 Two Birds with One Stone Page: 20 Pulling It All Together Page: 21 Curve Fitting Versus Lower and Upper Bounds Page: 22 Summary Page: 22 Challenge Exercises Page: 23 3. Better Living Through Better Hashing Page: 24 Associating Values with Keys Page: 24 Hash Functions and Hash Codes Page: 25 A Hashtable Structure for (Key, Value) Pairs Page: 26 Detecting and Resolving Collisions with Linear Probing Page: 26 Separate Chaining with Linked Lists Page: 28 Removing an Entry from a Linked List Page: 29 Evaluation Page: 30 Growing Hashtables Page: 31 Analyzing the Performance of Dynamic Hashtables Page: 32 Perfect Hashing Page: 33 Iterate Over (key, value) Pairs Page: 34 Summary Page: 34 Challenge Exercises Page: 35 4. Heaping It On Page: 37 Max Binary Heaps Page: 38 Inserting a (value, priority) Page: 39 Removing the Value with Highest Priority Page: 40 Representing a Binary Heap in an Array Page: 41 Implementation of Swim and Sink Page: 41 Summary Page: 42 Challenge Exercises Page: 42 5. Sorting Without a Hat Page: 44 Sorting by Swapping Page: 44 Selection Sort Page: 44 Anatomy of a Quadratic Sorting Algorithm Page: 45 Analyze Performance of Insertion Sort and Selection Sort Page: 45 Recursion and Divide and Conquer Page: 46 Merge Sort Page: 47 Quicksort Page: 48 Heap Sort Page: 49 Performance Comparison of O(N log N) Algorithms Page: 49 Tim Sort Page: 50 Summary Page: 51 Challenge Exercises Page: 51 6. Binary Trees: Infinity in the Palm of Your Hand Page: 52 Getting Started Page: 52 Binary Search Trees Page: 53 Searching for Values in a Binary Search Tree Page: 55 Removing Values from a Binary Search Tree Page: 55 Traversing a Binary Tree Page: 57 Analyzing Performance of Binary Search Trees Page: 57 Self-Balancing Binary Trees Page: 58 Analyzing Performance of Self-Balancing Trees Page: 60 Using Binary Tree as (key, value) Symbol Table Page: 60 Using the Binary Tree as a Priority Queue Page: 61 Summary Page: 62 Challenge Exercises Page: 62 7. Graphs: Only Connect! Page: 64 Graphs Efficiently Store Useful Information Page: 64 Using Depth First Search to Solve a Maze Page: 65 Breadth First Search Offers Different Searching Strategy Page: 67 Directed Graphs Page: 69 Graphs with Edge Weights Page: 72 Dijkstra’s Algorithm Page: 72 All-Pairs Shortest Path Page: 76 Floyd–Warshall Algorithm Page: 77 Summary Page: 78 Challenge Exercises Page: 79 8. Wrapping It Up Page: 80 Python Built-in Data Types Page: 80 Implementing Stack in Python Page: 81 Implementing Queues in Python Page: 81 Heap and Priority Queue Implementations Page: 82 Future Exploration Page: 82 Index Page: 84

Description:
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â??ll get to apply what youâ??ve learned to a novel challenge problemâ??simulating the experience you might find in a technical code interview. With this book, you will: Examine 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
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.