4 ms·
Easy: insert(list, node): node.next = list.head; list.head = node; sleep(list.count++); Remove the `sleep` in second version, and
by sherincall 9y ago
Easy:
insert(list, node):
node.next = list.head;
list.head = node;
sleep(list.count++);
Remove the `sleep` in second version, and quote significant speedup. See also http://thedailywtf.com/articles/The-Speedup-Loop http://thedailywtf.com/articles/The-Speedup-Loop