add h value tie break and measure time elasped for the algorithm