Searching

­

Depth First Search (DFS) and Breath First Search (BFS)

The two main methods to traverse each node in a graph - Depth First Search and Breath First Search.

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , |

Binary Search

Introduce Binary Search

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , |

[Leetcode] Find Peak Element

Find a peak element in an array and return its index.

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , |

[Leetcode] Find the Duplicate Number

Find a duplicate in an array with some other requirements.

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , |

[Leetcode] Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values.

November 14th, 2015|Categories: DS and Algorithms, Graph, Searching|Tags: , , , , , |

[Leetcode] Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values.

November 14th, 2015|Categories: DS and Algorithms, Graph, Searching|Tags: , , , , , |

[Leetcode] Search for a Range

Given a sorted array of integers, find the starting and ending position of a given target value.

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , |

[Leetcode] Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , |

[Leetcode] Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used.

November 29th, 2015|Categories: Array, DS and Algorithms, Recursion, Searching|Tags: , , , , |

[Leetcode] Word Search

Given a 2D board and a word, find if the word exists in the grid.

November 14th, 2015|Categories: DS and Algorithms, Graph, Searching|Tags: , , , , , |

[Leetcode] Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix.

November 14th, 2015|Categories: Array, DS and Algorithms, Searching|Tags: , , , , |

[Leetcode] Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix.

November 14th, 2015|Categories: Array, DS and Algorithms, Searching|Tags: , , , |

[Leetcode] Combinations

Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.

November 26th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , , |

[Leetcode] Find Minimum in Rotated Sorted Array

Find Minimum in Rotated Sorted Array

November 29th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , |

[Leetcode] Implement Trie (Prefix Tree)

Implement a trie with insert, search, and startsWith methods.

December 1st, 2015|Categories: DS and Algorithms, Searching, Tree|Tags: , , , , |

[Leetcode] Add and Search Word – Data structure design

Design a data structure that supports add(word) and search(word).

December 1st, 2015|Categories: DS and Algorithms, Hash, Searching, Tree|Tags: , , , , , |

[Leetcode] First Bad Version

Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to be bad.

December 12th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , |