I'm suffering a crisis of confidence in my ability as a computer programmer.

Yesterday I tried to come up with my own shortest path algorithm for a graph and after some hours I simply threw in the towel and learned Dijkstra's algorithm.

Is this the kind of thing a good programmer should be able to "reinvent" in a couple of hours or am I being unrealistic?

Oh well, at least I was able to reinvent bubble sort :D

A good programmer should realize that a great algorithm has already been written to solve a problem and doesn't waste time re-inventing wheels.

I doubt Dijkstra came up with the shortest path algorithm in a few hours, so that seems like a really high standard to use for determining if someone is a 'good programmer'
