Hi folks,
Maurice Lombardi wrote:
Gosh. How do you do with linked lists, a quite common situation I believe. If you append records only at the end of the list, you can use the last "next" pointer as a store pointer. But what do you do if you want to insert a new record in the middle of the list. Usually either: you keep the address of the next record in a temporary pointer and allocate the new record with the "next" pointer of the previous: invalid because you try to new an undisposed pointer. you allocate the new record with a "temporary" pointer (no problem up to that point, it will be a store pointer) and then insert it, playing with two "next" pointers: but the previous "next" goes from store to reference status. And you need to keep somewhere all "temporary" pointers which served you to allocate the elements ...
Hmm, right. Here you got me. For linked-list maintenance etc., we need the free play with pointers. (Awkward... I missed the trivial case by modeling the complex ones...)
Bye
Markus