Skip to content

Latest commit

 

History

History
371 lines (191 loc) · 11.5 KB

Notes.md

File metadata and controls

371 lines (191 loc) · 11.5 KB

Notes

Make sure it can be solved again.

Quadratic time is acceptable. Investigate linear time solution.

Make sure it can be solved again.

Is there a better solution?

Notice the reverse half algorithm.

  1. Consider supporting multiple consecutive *s.
  2. Compile the regular expression to a DFA for linear time matching.

What kind of problems can be solved with two pointers solution?

Make sure it can be solved again.

Make sure it can be solved again.

Make sure it can be solved again.

Is there a better solution?

Reduce the number of swaps.

Benchmark the performance against the one from standard library.

  1. Implement Boyer-Moore algorithm.
  2. Implement finite automata algorithm.
  3. Implement Knuth-Morris-Pratt algorithm.
  4. Implement Rabin-Karp algorithm.
  5. Implement Two-way string-matching algorithm.

How to come up with the bidirectional scan solution?

There are faster algorithms to do this.

  1. Make sure it can be solved again.
  2. Investigate the backtracking solution.
  3. How about DFA solution?

Why does the Heap's algorithm works?

How did I come up with the backtracking solution 2 and 3?

How to come up with the mathematical solution?

Optimize the solution.

Pay attention to the Newton’s method.

Optimize the solution.

Remember the solution. Think an iterative solution.

Make sure it can be solved again.

Make sure it can be solved again.

How to come up with the solution i ^ (i >> 1)?

Investigate other methods.

Optimize the solution.

Make a faster solution.

Solve it without using hash maps.

Solve it without using hash maps.

How does the greedy solution work?

Make sure it can be solved again.

How to come up with the bucket and pigeonhole solution?

Remember the KMP solution.

Optimize the solution.

Optimize the solution, especially the stack one.

Make sure it can be solved again.

Make sure it can be solved again.

Investigate the mathematical solution.

Remember the solution.

Make sure it can be solved again.

Make sure it can be solved again.

Why does the heap like binary tree (segment tree) works for n that is not a power of 2?

Make sure it can be solved again.

I consider this problem the hardest so far, is there a fast and elegant solution?

Investigate the binary index tree solution and make sure it can be solved again.

Why is the solution correct?

Make sure it can be solved again.

Make sure it can be solved again.

Why can I eliminate the usage of visited set?

How can you think of the greedy solution?

Make sure it can be solved again.

How does the mathematical solution work?

Make sure it can be solved again.

How can you come up with the sliding window solution?

Make sure it can be solved again.

Optimize the solution.

Why is the solution correct?

Make sure it can be solved again.

How do you know that the greedy algorithm works?

Make sure it can be solved again.

Remember the solution.

Remember the solution.

Optimize the solution and add the double hash map solution.

Make sure it can be solved again.

Optimize the solution.

Why is the binary heap solution correct?

Why is the solution correct?

Why is the solution correct?

Make sure it can be solved again.

Implement other solutions.

Why does the mathematical solution work?

Investigate the n log(n) time complexity solution.

Is there a best solution?

Why are all of those solutions correct?

Remember the dynamic programming solution.

Remember the solution.

Good problem. Why is the greedy solution correct?

The optimal solution requires some mathematical knowledge.

Remember the solution.

Remember the solution.

Why is the Duval algorithm correct?

Understand the minimax algorithm.

Make sure it can be solved again.

Make sure it can be solved again.

Make sure it can be solved again.

Why is this solution correct?

Why is this solution correct?