Wednesday, August 22, 2018

Work on optimal time complexity backward

August 22, 2018


Introduction


It is hard for me to learn that I have difficult time to perform at my best. No matter how confident I am, and how easy it is to be a programmer in my real life. To ace the interview, it is not easy task. 

I like to find ways to perform best next time. But I also need to relax and find some strategy to have critical thinking. 

Algorithm design 


work on optimal time complexity backward


I like to use the example to explain that it is related to think process. To work on the algorithm, one of ideas is to work on optimal time complexity backward. Can we work on the solution based on O(1), if not how about logN, or N, and then NlogN, and N^2 solution.

If I give a solution based on O(N^2), then I waste time to come out the solution.

The best strategy is to target the scalability, optimal time complexity.

One of examples is to design iterator for list of iterators. To think about O(1) time complexity, ignore the pre-processing time, we can design an iterator using O(1) time, merge all iterators to one iterator.


Data structure 


Once I set the target for optimal time complexity, it is easy for me to search the data structure to make it happen.

No comments:

Post a Comment