Data Structures and Algorithms of Life
I knew software engineering would leave me nuts in the end. This is how I have started thinking now: ( dATA sTRUctuRES AND aLGOrITHMs OF LIFE)
If i can remove the if() of my life then I can also remove the else() part and it will be just a simple statement. But then it wont handle any conditions and the complexity will be O(n) to search a single happy moment, so its better to do a binary search of happy moments and make it O(logn).
—->Improvement
Now I reduce the search time to O(1), using hash map just type in the detail of your happy moment and its there in a constant time 🙂
~ An Empty Glass