DEV Community

[Comment from a deleted post]
Collapse
 
theodesp profile image
Theofanis Despoudis

Hey now you have just tripled the space complexity. From O(n) to 3*O(n). It's still considered O(n) but if you had only limited ram then the cost of swapping from the disk to the RAM would be noticable.