I have such a task at university: we have $n$ tasks, the $i$-th of them can be done between moment $b(i)$ and $e(i)$. If we decide to perform a task in moment $x$, we finish performing it in moment $x+1$. We can perform at most 1 task at a time and we cannot interrupt performing it. Create an algorithm to check if it is possible to perform all the tasks. $b(i)$ and $e(i)$ may not be integers.
I have done some research online, but I haven't found anything concerning this problem.
Actually I think the following algorithm would work (I haven't found a counterexample yet):
iterate over all the tasks ordered by increasing $e(i)$ and for each of them try performing it the earliest possible. If cannot, return false. If all tasks are added, return true.
If this algorithm works, how could I prove it?