Open ivancho-ifa opened 6 months ago
The current implementation has time complexity O(n^2). It could be improved to O(n) by using recursion. I think it would be beneficial to have both approaches as it is the classic dilemma time vs. memory optimization.
O(n^2)
O(n)
nb
@ivancho-ifa which algorithm?
which algorithm
Guys, I believe this issue is about the reverse traversal of a Linkedlist Datastructure.
The current implementation has time complexity
O(n^2)
. It could be improved toO(n)
by using recursion. I think it would be beneficial to have both approaches as it is the classic dilemma time vs. memory optimization.