Javascript Array Shift Time Complexity Of Bfs And Dfs