You don't have to move or free pointers, fragmenting your heap.



Has anyone ever implemented a stack using a linked list ?
Who, exactly, thinks linked-lists are faster and/or better ?

I've spent years coding ( for money ) in FORTH and PostScript,
so I'm quite familiar with indexing into the array that is the stack.

In VC++ 8.0, every local variable is
an index into “ the array that is the stack ”,
not a journey down a linked list, not a thread.

Only one end of a stack is dynamic.
You don't have to move or free pointers, fragmenting your heap;
instead, you can create dedicated heaps and destroy them.

With a dynamic array of pointers ( instead of a linked list )
you can do things like: copy-off a chunck of pointers,
quick-sort it any way you like and do binary searches on it.

Try doing that with linked lists !

.



Relevant Pages

  • Re: Automatic Memory Management Question
    ... // The Stack class exists in the framework under System.Collections ... // It is a linked list because Stack doesn't contain a direct reference to any other Node. ... throw new Exception("Can't Pop from an empty Stack."); ... I have used wikipedia to explore nodes and linked lists. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: You dont have to move or free pointers, fragmenting your heap.
    ... so I'm quite familiar with indexing into the array that is the stack. ... With a dynamic array of pointers ... Try doing that with linked lists! ...
    (microsoft.public.vc.language)
  • Re: Stack or Heap
    ... The combination of default low stack size ... combined with a default that puts many arrays on the stack ... programmers never use arrays prefering linked lists etc. ...
    (comp.lang.fortran)
  • Re: Faster than link list?
    ... I'd suggest something that has less addressing overhead: stack or array. ... linked lists are still extremely fast. ...
    (comp.graphics.algorithms)
  • Re: Can Excel do this with coding?
    ... will also need a series of free-space pointers. ... Linked lists can be implemented with arrays. ... One array holds indices into ... Or create a node type which includes an successor index member, ...
    (microsoft.public.excel.worksheet.functions)

Quantcast