I was solving a problem on SPOJ which says to count inversions. It can be solved using BIT or Merge Sort algorithm. I searched the topic on the internet, I found a page on Geeksforgeeks with exactly the same problem. So I try to understand it, but after a while I could not get much of it. So I copied those functions and used it directly in my solution. But I started feeling guilty. I am interested to know how you guys learn an algorithm. This is my first blog post, so please ignore if I made any mistakes and help me. Thank you. ^_^
At least try to type the algorithms you learn instead of copying. Also, don't force yourself into getting AC for problems that might be too hard for you :)
From a practical perspective, it really depends. For certain data structures like Segment trees or algorithms like Dijkstra's, you'll often be required to modify them, so it's important to understand.
On the other hand, you could probably get around fine without understanding the details of how a flow algorithm or FFT work. Note that many of these algorithms that you can black box are mostly more advanced algorithms.
It does work pretty well for 'small' algorithms like, for example, GCD or sorting. But when you use more complex algorithms like, for example, Dinic or Hungarian, it is difficult to 'remember' the implementation in a real contest if you have know idea how it works.
If anyone is re-implementing something like Hungarian algorithm or Voronoi diagram from scratch in a contest.... orz
correction: an "onsite" contest :V