cpppro

Linked Lists

In C Tidbits, Data Structures in C/C++, Pointers & Callbacks, Tutorials on April 12, 2007 at 2:55 pm

Linked Lists Basics
[Download this tutorial as linked lists tutorial , for updated conetnt and comments, generate a new pdf with the option which is present below the post]

What are Linked Lists?
Linked lists store collections of data like arrays.  Linked lists are chain of records/nodes, one record/node points to the next. Record holds the data.

Why Linked Lists?
There are several  disadvantages with arrays, here are some…
1) The size of the array is fixed. Most often this size is specified at compile time however the size of the array can be deferred until the array is created at runtime (from heap), but after that it remains fixed. This causes to waste memory eventhough e may not use.
2) Inserting new elements at the front is potentially expensive because existing elements need to be shifted over to make room.
3)When array was full, to insert more data, it need to be resized, this operation is quite expensive, even may not be possible if in case memory got fragmented.
Linked lists performs well where arrays fail to do it.
Please refer http://www.refcode.net/2013/02/linked-lists.html

 

Advertisements
  1. […] Please refer this post for linked list basics and all other operations on linked lists. […]

  2. […] If you are interested in more operations on linked list, visit this post […]

  3. Excellent tutorial, helped a lot in understanding the concepts, thanks

  4. Excellent site where i have got most useful information at one place in basic to very advance level I like this site very much

  5. fjbnheipsssf…

    Anyway, you should do your best ;)…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: