I am currently a Computer Science undergraduate in my final year. I think this question applies to more than just Computer Science students, so I'll make it as general as possible.
Throughout my student years, I have always found it very difficult to establish when to admit I am blocked in the implementation of a given task/assignment.
My question is: when is the correct moment to admit I'm on the wrong track and ask for help? I do not want to bother my colleagues (or even worse, teachers) with very general questions such as "How do I do that", nor do I want to take a path and find myself in the situation where I cannot even express the question because of how tangled the road to that point was.
I wonder if the time after which I have to ask for help is quantifiable, something like "If it lasts longer than 3 hours, ask for help". If there is no general rule for establishing this time, what are the factors that must be taken into consideration?