Is a Linked-List implementation without using pointers possible or not?

前端 未结 14 1565
再見小時候
再見小時候 2020-12-01 07:57

My question is very simple, can one using C++, implement a link-list data structure without using pointers (next nodes)? To further qualify my question, I\'m mean can one cr

14条回答
  •  猫巷女王i
    2020-12-01 08:35

    As an addition to the existing answers of using a previous and a next vector/array, we could build on top of a more dynamically resizing structure, i.e. losing the amortization on the resizing operation.

    Why do I think this is suitable? Well, we have gained some advantages by using vectors/arrays, but we got the amortized resizing in return. If we can rid ourselves of the latter, we may have turned the trade entirely in our favor!

    Specifically, I am referring to Resizable Arrays in Optimal Time and Space. It's a very interesting data structure, particularly as the basis for other data structures such as the one we are talking about.

    Note that I have linked to the technical report, which, unlike the regular paper, also includes the (highly interesting) explanation of how doubly-resizable arrays were achieved.

提交回复
热议问题