A hands-on, easy-to-comprehend guide that is perfect for anyone who needs to understand algorithms. With the explosive growth in the amount of data and the diversity of computing applications, efficient algorithms are needed now more than ever. Programming languages come and go, but the core of programming--algorithms and data structures--remains the same. Absolute Beginner's Guide to Algorithms is the fastest way to learn algorithms and data structures. Using helpful diagrams and fully annotated code samples in Javascript, you will start with the basics and gradually go deeper and broader into all the techniques you need to organize your data. Start fast with data structures basics: arrays, stacks, queues, trees, heaps, and more Walk through popular search, sort, and graph algorithms Understand Big-O notation and why some algorithms are fast and why others are slow Balance theory with practice by playing with the fully functional JavaScript implementations of all covered data structures and algorithms Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details. Cover Title Page Copyright Page Contents at a Glance Table of Contents Part I: Data Structures 1 Introduction to Data Structures Right Tool for the Right Job Back to Data Structures Conclusion Some Additional Resources 2 Big-O Notation and Complexity Analysis It’s Example Time It’s Big-O Notation Time! Conclusion Some Additional Resources 3 Arrays What Is an Array? Adding an Item Deleting an Item Searching for an Item Accessing an Item Array Implementation / Use Cases Arrays and Memory Performance Considerations Access Insertion Deletion Searching Conclusion Some Additional Resources 4 Linked Lists Meet the Linked List Finding a Value Adding Nodes Deleting a Node Linked List: Time and Space Complexity Deeper Look at the Running Time Space Complexity Linked List Variations Singly Linked List Doubly Linked List Circular Linked List Skip List Implementation Conclusion Some Additional Resources 5 Stacks Meet the Stack A JavaScript Implementation Stacks: Time and Space Complexity Runtime Performance Memory Performance Conclusion Some Additional Resources 6 Queues Meet the Queue A JavaScript Implementation Queues: Time and Space Complexity Runtime Performance Memory Performance Conclusion Some Additional Resources 7 Trees Trees 101 Height and Depth Conclusion Some Additional Resources 8 Binary Trees Meet the Binary Tree Rules Explained Binary Tree Variants What about Adding, Removing, and Finding Nodes? A Simple Binary Tree Implementation Conclusion Some Additional Resources 9 Binary Search Trees It’s Just a Data Structure Adding Nodes Removing Nodes Implementing a Binary Search Tree Performance and Memory Characteristics Conclusion Some Additional Resources 10 Heaps Meet the Heap Common Heap Operations Heap Implementation Heaps as Arrays The Code Performance Characteristics Removing the Root Node Inserting an Item Performance Summary Conclusion Some Additional Resources 11 Hashtable (aka Hashmap or Dictionary) A Very Efficient Robot From Robots to Hashing Functions From Hashing Functions to Hashtables Adding Items to Our Hashtable Reading Items from Our Hashtable JavaScript Implementation/Usage Dealing with Collisions Performance and Memory Conclusion Some Additional Resources 12 Trie (aka Prefix Tree) What Is a Trie? Inserting Words Finding Items Deleting Items Diving Deeper into Tries Many More Examples Abound! Implementation Time Performance Conclusion Some Additional Resources 13 Graphs What Is a Graph? Graph Implementation Representing Nodes The Code Conclusion Some Additional Resources Part II: Algorithms 14 Introduction to Recursion Our Giant Cookie Problem Recursion in Programming Recursive Function Call Terminating Condition Conclusion Some Additional Resources 15 Fibonacci and Going Beyond Recursion Recursively Solving the Fibonacci Sequence Recursion with Memoization Taking an Iteration-Based Approach Going Deeper on the Speed Conclusion Some Additional Resources 16 Towers of Hanoi How Towers of Hanoi Is Played The Single Disk Case It’s Two Disk Time Three Disks The Algorithm The Code Solution Check Out the Recursiveness! It’s Math Time Conclusion Some Additional Resources 17 Search Algorithms and Linear Search Linear Search Linear Search at Work JavaScript Implementation Runtime Characteristics Conclusion Some Additional Resources 18 Faster Searching with Binary Search Binary Search in Action Sorted Items Only, Please Dealing with the Middle Element Dividing FTW! The JavaScript Implementation Iterative Approach Recursive Approach Example of the Code at Work Runtime Performance Conclusion Some Additional Resources 19 Binary Tree Traversal Breadth-First Traversal Depth-First Traversal Implementing Our Traversal Approaches Node Exploration in the Breadth-First Approach Node Exploration in the Depth-First Approach Looking at the Code Performance of Our Traversal Approaches Conclusion Some Additional Resources 20 Depth-First Search (DFS) and Breadth-First Search (BFS) A Tale of Two Exploration Approaches Depth-First Search Overview Breadth-First Search Overview Yes, They Are Different! It’s Example Time Exploring with DFS Exploring with BFS When to Use DFS? When to Use BFS? A JavaScript Implementation Using the Code Implementation Detail Performance Details Conclusion Some Additional Resources 21 Quicksort A Look at How Quicksort Works A Simple Look Another Simple Look It’s Implementation Time Performance Characteristics Time Complexity Space Complexity Stability Conclusion Some Additional Resources 22 Bubblesort How Bubblesort Works Walkthrough The Code Conclusion Some Additional Resources 23 Insertion Sort How Insertion Sort Works One More Example Algorithm Overview and Implementation Performance Analysis Conclusion Some Additional Resources 24 Selection Sort Selection Sort Walkthrough Algorithm Deep Dive The JavaScript Implementation Conclusion Some Additional Resources 25 Mergesort How Mergesort Works Mergesort: The Algorithm Details Looking at the Code Conclusion Some Additional Resources 26 Conclusion Index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z