Search Results


8 matches found for 'binary search'

Search in a rotated sorted array

... the array is partially sorted, it turns out that this array is still a good candidate for binary search. The key to solving this is to understand your boundaries thoroughly. The traditional binary search algorithm gives you access to the lowest index, the highest index, and using the two indices you can determine the middle index.


RDBMS Indexing

... the index created, instead of going through each row until we find id = 99999, we can now do a binary search on the index ids, and find the row we are looking for in \(O(log n)\) time.


Symmetry in a Tree

... // set left child ct.layout(); Problem Given a binary tree (not necessarily a binary search tree), check if the tree is symmetric. A tree is symmetric if the nodes on the left mirror the nodes on the right.


Build a Binary Tree with Pre-order and In-order traversal data

Problem Given a pre-order traversal array of integers and an in-order traversal array of integers, construct a binary tree. Input preorder - array of integers inorder - array of integers # Definition for a binary tree node.


Algorithm Interview Problems

Welcome This page contains solutions to common interview problems that may be encountered. Arrays Longest Substring Without Repeating Characters Rotate a 2D Matrix Buy/Sell Two Stocks Merge Intervals Next Permutation Random Permutation Replace all occurrences of a space with a string Linked Lists Reversing sublists of singly linked lists Cycles in singly linked lists Overlapping singly linked lists Merging two sorted singly linked lists Merge k sorted lists Recursion Counting the path of sums Money Denominations Phone Number Mnemonics Unique Permutation Dynamic Programming Perfect Squares Find the Maximum Min Path Binary Trees Tree Symmetry Iterative In-Order Traversal of a Binary Tree Construct a Binary Tree from Pre-Order Traversal and In-Order Traversal BST Validate a BST Binary Heaps Merge k sorted lists Graphs Find a path in a maze from start to finish Flip colors in a matrix Search Search in a rotated sorted array Find the Duplicate Number Greedy Algorithms Queue Reconstruction By Height Trie Build a Trie in Python Invariant Compute the max.


Machine Learning Basics

Supervised Learning In supervised learning, we take some data and predict an output in a pre-defined structure. There are two categories: Regression: When a function is given some input variables, what is the continuous output? i.


Data stores in Software Architectures

Use Cases There are many ways to store your data. In this article we'll walk through some examples of data storage in common system designs. Reminder: There is no single best storage choice and they may vary heavily depending on things such as access patterns and scale.


Algorithm Handbook

Introduction Welcome to the algorithm handbook wiki! In this wiki you will find a mini-cheat sheet overview of data structures, and examples of their usages in modern languages. Algorithm problems can be found here.