How to learn lists in C

Discussion in 'C Programming' started by __frank__, Sep 30, 2005.

  1. __frank__

    __frank__ Guest

    I have some difficulties to learn lists and its
    coding in C language.

    Is there a site that explain this argument in a simple
    way (with examples of course)?

    I tried to "google" but results are huge and
    I don't know what to choose.

    Thanks in advance
     
    __frank__, Sep 30, 2005
    #1
    1. Advertising

  2. __frank__

    Skarmander Guest

    __frank__ wrote:
    > I have some difficulties to learn lists and its
    > coding in C language.
    >
    > Is there a site that explain this argument in a simple
    > way (with examples of course)?
    >
    > I tried to "google" but results are huge and
    > I don't know what to choose.
    >

    Try "linked list", which is what I assume you're talking about. They are
    indeed a staple of learning C.

    The first Google hit I got for '"linked list" C' was
    http://vergil.chemistry.gatech.edu/resources/programming/c-tutorial/lists.html,
    which looks pretty neat. The second was
    http://cslibrary.stanford.edu/103/, which looks neater.

    Read up, try stuff yourself, come back to the group when you're stuck on
    something specific.

    S.
     
    Skarmander, Sep 30, 2005
    #2
    1. Advertising

  3. __frank__

    copx Guest

    "__frank__" <> schrieb im Newsbeitrag
    news:aie%e.4305$...
    >I have some difficulties to learn lists and its
    > coding in C language.
    >
    > Is there a site that explain this argument in a simple
    > way (with examples of course)?
    >
    > I tried to "google" but results are huge and
    > I don't know what to choose.


    There are some very good tutorials available at the Stanford CS Ed Library:
    http://cslibrary.stanford.edu/
    Despite their origin their are very easy to understand.
    They feature examples and quality illustrations. I think they are perfect
    for you.
     
    copx, Sep 30, 2005
    #3
  4. __frank__

    Mabden Guest

    "__frank__" <> wrote in message
    news:aie%e.4305$...
    > I have some difficulties to learn lists and its
    > coding in C language.
    >


    New item: allocate memory, fill in data, set "next" pointer to null, set
    current end pointer (was null) to it. Simple.

    --
    Mabden
     
    Mabden, Oct 2, 2005
    #4
  5. __frank__

    __frank__ Guest

    __frank__, Oct 4, 2005
    #5
  6. Mabden wrote:
    > "__frank__" <> wrote in message
    > news:aie%e.4305$...


    > > I have some difficulties to learn lists and its
    > > coding in C language.

    >
    > New item: allocate memory, fill in data, set "next" pointer to null, set
    > current end pointer (was null) to it. Simple.


    to "__frank__": Mabden's post only describes (very briefly) how to add
    an item to the end of a list. It definitly isn't a complete
    introduction to linked lists. The other replies you received looked ok.


    Note: Although I "plonked" Mabden I don't actually use kill files. I
    have responded to this post because his answer was poor and many
    regulars have kill-filed him.


    --
    Nick Keighley
     
    Nick Keighley, Oct 4, 2005
    #6
  7. __frank__

    Mabden Guest

    "Nick Keighley" <> wrote in message
    news:...
    > Mabden wrote:
    > > "__frank__" <> wrote in

    message
    > > news:aie%e.4305$...

    >
    > > > I have some difficulties to learn lists and its
    > > > coding in C language.

    > >
    > > New item: allocate memory, fill in data, set "next" pointer to null,

    set
    > > current end pointer (was null) to it. Simple.

    >
    > to "__frank__": Mabden's post only describes (very briefly) how to add
    > an item to the end of a list. It definitly isn't a complete
    > introduction to linked lists. The other replies you received looked

    ok.

    Mine's not OK? Not even OK? BTW, I was not actually going for a complete
    introduction, but I challenge you to make a better one in under 20
    words. Especially one better than OK.

    > Note: Although I "plonked" Mabden I don't actually use kill files. I
    > have responded to this post because his answer was poor and many
    > regulars have kill-filed him.


    Ah, politics. Isn't that a little off-topic in a thread titled, "
    How to learn lists in C"?

    OK, perhaps something to entertain the more advanced programmer,
    something I am trying out for my Sudoku game:

    http://arxiv.org/PS_cache/cs/pdf/0011/0011047.pdf

    "The dance steps. One good way to implement algorithm X is to represent
    each 1 in the

    matrix A as a data object x with five fields L[x],R[x], U[x],D[x],C[x].
    Rows of the matrix

    are doubly linked as circular lists via the L and R fields ("left" and
    "right"); columns are

    doubly linked as circular lists via the U and D fields ("up" and
    "down"). Each column

    list also includes a special data object called its list header.

    The list headers are part of a larger object called a column object.
    Each column object

    y contains the fields L[y],R[y], U[y],D[y], and C[y] of a data object
    and two additional

    fields, S[y] ("size") and N[y] ("name"); the size is the number of 1s in
    the column, and the

    name is a symbolic identifier for printing the answers. The C field of
    each object points

    to the column object at the head of the relevant column.

    The L and R fields of the list headers link together all columns that
    still need to be

    covered. This circular list also includes a special column object called
    the root, h, which

    serves as a master header for all the active headers. The fields
    U[h],D[h],C[h], S[h], and

    N[h] are not used.

    For example, the 0-1 matrix of (3) would be represented by the objects
    shown in

    Figure 2, if we name the columns A, B, C, D, E, F, and G. (This diagram
    "wraps around"

    toroidally at the top, bottom, left, and right. The C links are not
    shown because they

    would clutter up the picture; each C field points to the topmost element
    in its column.)

    Our nondeterministic algorithm to find all exact covers can now be cast
    in the following

    explicit, deterministic form as a recursive procedure search(k), which
    is invoked initially

    with k = 0:

    If R[h] = h, print the current solution (see below) and return.

    Otherwise choose a column object c (see below).

    Cover column c (see below).

    For each r ? D[c], DD[c], . . . , while r 6= c,

    set Ok ? r;

    for each j ? R[r], RR[r], . . . , while j 6= r,

    cover column j (see below);

    search(k + 1);

    set r ? Ok and c ? C[r];

    for each j ? L[r], LL[r], . . . , while j 6= r,

    uncover column j (see below).

    Uncover column c (see below) and return.

    The operation of printing the current solution is easy: We successively
    print the rows

    containing O0, O1, . . . , Ok?1, where the row containing data object O
    is printed by

    printing NC[O], NC[R[O]], NC[R[R[O]]], etc."


    --
    Mabden
     
    Mabden, Oct 6, 2005
    #7
    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. JustSomeGuy

    Sorting lists of lists...

    JustSomeGuy, Jun 17, 2004, in forum: C++
    Replies:
    0
    Views:
    334
    JustSomeGuy
    Jun 17, 2004
  2. Porky Pig Jr
    Replies:
    3
    Views:
    1,077
    Fuzzyman
    May 12, 2004
  3. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    425
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  4. CoreyWhite
    Replies:
    1
    Views:
    675
    JohnQ
    Mar 31, 2007
  5. Alexander
    Replies:
    20
    Views:
    1,072
    BGB / cr88192
    Sep 11, 2010
Loading...

Share This Page