4 ms·
Wouldn't it need to be N-2? N-1's next is N, but prev should point to N-1.
by jmholla 5y ago
Wouldn't it need to be N-2? N-1's next is N, but prev should point to N-1.
- phkahler 5y agoThe only reason we need to point to N-1 is to get access to its next pointer for doing deletes (in my case where I never scan the list backwards). So rather than point to N-1 it suffices to point directly at its next pointer.