Implementing LPT algorithm