Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's no such thing as 'O(n/2)', big-O notation is about worst-case complexity. O(n) means 'linear time in the number of elements', not 'n operations' or something.

But in practice, the amortized time complexity will indeed usually be half of the worst-case scenario when removing elements from a vector.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: