> For the complete documentation index, see [llms.txt](https://tingreavinash.gitbook.io/the-tech-toolbox/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tingreavinash.gitbook.io/the-tech-toolbox/interview-preparation/google-interview/algorithms.md).

# Algorithms

Can you explain..

* Difference between a recursive and an iterative algorithm?
* Difference between dynamic programming and greedy algorithms?
* Difference between a breadth-first search and a depth-first search?
* How to use divide-and-conquer to solve a problem?
* How the Johnson's algorithm can be used to find the shortest paths between all pairs of vertices in a sparse graph?
* Time and space complexity of a particular algorithm?
* How the Dijkstra's algorithm can be used to find the shortest path in a graph with non-negative edge weights?
* How the Bellman-Ford algorithm can be used to find the shortest path in a graph with negative edge weights?
* Write code to implement a specific algorithm, such as quicksort or binary search?
* Implement an algorithm to find the longest increasing subsequence in an array?
* Implement an algorithm to detect a cycle in a directed graph?
* Write code to solve the traveling salesman problem using dynamic programming or approximation algorithms?
* Implement an algorithm to solve the matrix chain multiplication problem using dynamic programming?
* Implement an algorithm to solve the knapsack problem using greedy algorithms or dynamic programming?
* Write code to solve the huffman coding problem using a priority queue?
