Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
An intern approached me for help in one of their past exam questions. They said they had already turned in the exam but just wanted to know the answer. The question was not that hard and I had a bit of time to kill so I helped them.
Me: So, to make it O(n), you have to make it a double linked list, and keep a tail.
Them: But the problem requires us to solve it with a single liked list.
Me: You can just iterate it at the end to make it single-linked again. That costs O(n), so the solution is still O(n).
Them: Oh yeah right. I don't think we even need a tail though, we could just have a variable pointing to the last link.
Me: ...which is called a tail.
rant
data structures
linked list
time complexity