Optimal Time-Complexity Speed Planning for Robot Manipulators