Algorithm For Time Complexity Graph