4 Replies - 789 Views - Last Post: 07 May 2010 - 05:53 AM Rate Topic: -----

#1 IngeniousHax   User is offline

  • |>|20-514<|{3|2

Reputation: 84
  • View blog
  • Posts: 1,385
  • Joined: 28-March 09

Question on linked lists

Posted 06 May 2010 - 08:22 PM

I don't understand how linked lists work... I mean, you can enter a bunch of information into them, but it's not like they store it in an array or anything (or does it? o.o;; )

IDK, if someone could please explain how they work, I would greatly appreciate it.

This post has been edited by IngeniousHax: 06 May 2010 - 08:22 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Question on linked lists

#2 KYA   User is offline

  • Wubba lubba dub dub!
  • member icon

Reputation: 3202
  • View blog
  • Posts: 19,234
  • Joined: 14-September 07

Re: Question on linked lists

Posted 06 May 2010 - 08:30 PM

Your wish is my command.
Was This Post Helpful? 2
  • +
  • -

#3 r.stiltskin   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2032
  • View blog
  • Posts: 5,435
  • Joined: 27-December 05

Re: Question on linked lists

Posted 06 May 2010 - 08:35 PM

No, not an array. Each element (each unit of data -- whatever type it is) is stored in a node. A node is a struct consisting of a data member to be assigned that element, plus one or two pointers. There is at least a pointer holding the address of the next node in the list (or NULL if there is no next node). And there may be another pointer holding the address of the previous node.

It's called a linked list because each node is linked, via the pointers, to the next node and possibly the previous node. It functions like a continuous list, but because the nodes are dynamically allocated at different times it doesn't occupy a contiguous area of memory (as an array does).
Was This Post Helpful? 2
  • +
  • -

#4 IngeniousHax   User is offline

  • |>|20-514<|{3|2

Reputation: 84
  • View blog
  • Posts: 1,385
  • Joined: 28-March 09

Re: Question on linked lists

Posted 06 May 2010 - 08:43 PM

Thank you guys very much. @KYA Very informative writeup, really appreciate the link to such.

This post has been edited by IngeniousHax: 06 May 2010 - 08:43 PM

Was This Post Helpful? 0
  • +
  • -

#5 Smartymakk   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-May 10

Re: Question on linked lists

Posted 07 May 2010 - 05:53 AM

very informative.

very informative.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1