=> tuples.push({node: child, parentNode: parent});
const getTuple = () => tuples[bfs ? "shift" : "pop"]();
Ahh, alright
Fine if it's a singleton thingy I guess
Making getTuple accept arguments let's you pull it out into a parent scope, reducing memory
Also, I think this would be much faster: const getTuple = (tuples, bfs) => bfs ? tuples.shift() : tuples.pop();
Обсуждают сегодня