Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 17th, 2006, 3:45 PM   #1
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Linked Lists

I've read the section from my book on linked lists. The thing is though I kinda grasp the entire concept of it. I just don't know why would you use them in a real life situation.

I find that the book Sam's C++ in 24 hours doesn't do a good job of explaining linked lists. So please any help would be greatly appreciated.
Eric the Red is offline   Reply With Quote
Old Mar 17th, 2006, 4:16 PM   #2
Seif
Hobbyist Programmer
 
Seif's Avatar
 
Join Date: Jan 2006
Location: UK
Posts: 214
Rep Power: 3 Seif is on a distinguished road
A linked list consists of a node of two parts. Firstly the data that is to be stored in the list, then secondly a field to indicate where the next node in the list is located. This allows items to be added to the list dynamically, unlike static lists i.e in the form of arrays.

Dynamic lists have 2 main advantages over static lists.

1). Static lists such as arrays cannot be made longer on demand.

2). Saves waste of memory (i.e array[100]) when the actual is short (only 10 items that need to be added to the list, leaving 90 wasted allocated fields in memory)

sorry, I cant elaborate any further or making myself clear too well, as I am late for the pub and need to dash... if you need anymore help send me your email and I can send you some lecture slides i have on linked lists if you like.
Seif is offline   Reply With Quote
Old Mar 17th, 2006, 4:21 PM   #3
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Quote:
Originally Posted by Seif
A linked list consists of a node of two parts. Firstly the data that is to be stored in the list, then secondly a field to indicate where the next node in the list is located. This allows items to be added to the list dynamically, unlike static lists i.e in the form of arrays.

Dynamic lists have 2 main advantages over static lists.

1). Static lists such as arrays cannot be made longer on demand.

2). Saves waste of memory (i.e array[100]) when the actual is short (only 10 items that need to be added to the list, leaving 90 wasted allocated fields in memory)

sorry, I cant elaborate any further or making myself clear too well, as I am late for the pub and need to dash... if you need anymore help send me your email and I can send you some lecture slides i have on linked lists if you like.
yes. I sent you a personal message with me e-mail. Those slides will be a lot of help and thanks a lot.


I'm up for all the help i can get so if anyone has anything else to add please feel free to write it.
Eric the Red is offline   Reply With Quote
Old Mar 17th, 2006, 4:59 PM   #4
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Well if you search the forum or even try to take a look at the C forum you would see lots of threads about the subject. Like Seif said, those two are the main advantages.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 18th, 2006, 12:45 AM   #5
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
well, the text you have does only provide a cursory glance at singly-linked lists.

however, two things you can do to help with that is to copy and play with the code, and examine the pictorial representations of what's really going on there with the data structure pointing to the next one and so on. i used one of their books to try and generate 10,000 random numbers, sort them into a list from highest to lowest, and print the results. the conclusion of that experiment led to marginal progress and i would suggest grounding yourself in the other subjects in that book and try again. (i.e. skip it). this topic is usually covered only after you have spent a lot of time on the basics. i think the pictures helped me the most. draw diagrams, modify the code, etc.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Mar 18th, 2006, 5:25 AM   #6
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by bl00dninja
well, the text you have does only provide a cursory glance at singly-linked lists.
Well there is always google.
Quote:
Originally Posted by Google.com
Results 1 - 10 of about 232,000,000 for linked list. (0.44 seconds)
I think that is enough to get one going.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 19th, 2006, 12:47 AM   #7
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
Red face

indeed, google rules.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC