Re: Algorithms using Python?

Discussion in 'Python' started by Dennis Lee Bieber, Sep 21, 2012.

  1. On Fri, 21 Sep 2012 14:07:01 -0600, Ian Kelly <>
    declaimed the following in gmane.comp.python.general:

    >
    > It seems to work fine to me.


    You are working with dynamically allocated memory for the nodes; I
    was envisioning the implementation of linked lists in what would have
    been statically allocated arrays (or one large dynamic memory block with
    all data tracking kept internally) (ie; a naive attempt using a Python
    list where nodes are [nxtIndex, data], and accidently removing a node
    from that list).

    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
     
    Dennis Lee Bieber, Sep 21, 2012
    #1
    1. Advertising

  2. On Fri, 21 Sep 2012 17:14:14 -0400, Dennis Lee Bieber wrote:

    > On Fri, 21 Sep 2012 14:07:01 -0600, Ian Kelly <>
    > declaimed the following in gmane.comp.python.general:
    >
    >
    >> It seems to work fine to me.

    >
    > You are working with dynamically allocated memory for the nodes;


    Doesn't everybody? :)


    > I was envisioning the implementation of linked lists in what would have
    > been statically allocated arrays (or one large dynamic memory block with
    > all data tracking kept internally) (ie; a naive attempt using a Python
    > list where nodes are [nxtIndex, data], and accidently removing a node
    > from that list).


    Writing Fortran77 in Python!

    :)



    --
    Steven
     
    Steven D'Aprano, Sep 22, 2012
    #2
    1. Advertising

  3. On 22 Sep 2012 01:28:04 GMT, Steven D'Aprano
    <> declaimed the following in
    gmane.comp.python.general:


    >
    > Writing Fortran77 in Python!
    >


    Well, if one really wants to learn "linked lists" from the core
    concept where the links refer directly to offsets within the memory
    block (array) <G>; then expand to where the links refer to dynamically
    allocated memory... Do the same with stacks, queue, and deques... Much
    easier to debug if all one needs to dump is a snapshot of an array and
    analyze for "lost free memory" (any array entry that is not "pointed to"
    when traversing the chain of data nor the chain of free cells) -- since
    such would be uncollected garbage in lower-level languages. Python masks
    such concerns -- you unlink a node, and it gets garbage collected...

    You should have seen the final project in my algorithms class (ca.
    1979)... A hashed-head multiple-linked list * ... Done using a version
    of BASIC that only supported four open files at a time (on top of which,
    I used chain-loading to move from the master controller (user interface,
    if you will) to each functional operation). The instructor had made the
    mistake of stating the project could be done in any language /he/ knew
    (so he received my BASIC, a lot of FORTRAN-IV, and at least one
    Meta-Symbol).


    * And in the last 30+ years, I've seen only ONE non-classroom use of an
    HHMLL -- the directory structure of AmigaOS!

    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
     
    Dennis Lee Bieber, Sep 22, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. efrat
    Replies:
    2
    Views:
    390
    Bryan Olson
    Sep 28, 2006
  2. efrat
    Replies:
    14
    Views:
    756
    Scott David Daniels
    Nov 9, 2007
  3. Brendon Towle
    Replies:
    4
    Views:
    320
    Fredrik Lundh
    Sep 28, 2006
  4. Brendon Towle
    Replies:
    8
    Views:
    447
    sturlamolden
    Sep 29, 2006
  5. Vicent Giner

    Using Python for programming algorithms

    Vicent Giner, May 17, 2008, in forum: Python
    Replies:
    50
    Views:
    1,588
    sturlamolden
    May 21, 2008
Loading...

Share This Page