LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-31-2005, 03:30 AM   #1
shivaligupta
Member
 
Registered: Oct 2004
Posts: 45

Rep: Reputation: 15
data structure with variable capacity(not a linked list)


Is there any advantage of using a data-structure with the following characterstic:

the number of elements that can be inserted depends on the sequence of inputs.

That is the number of elements that the data structure can hold will be different for the following sequence,
1,2,3,4,5,6,7
2,1,4,6,5,7,3

And does there exists any such data structure?

Though linked list has varying capacity but its storage capacity doesn't vary with the sequence in whic h the no.'s are entered.

Last edited by shivaligupta; 01-31-2005 at 04:06 AM.
 
Old 01-31-2005, 03:56 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
A 'linked list' does what you're looking for.

Dave
 
Old 01-31-2005, 11:54 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
What do you exactly mean by this:
Quote:
That is the number of elements that the data structure can hold will be different for the following sequence,
1,2,3,4,5,6,7
2,1,4,6,5,7,3
and:
Quote:
Though linked list has varying capacity but its storage capacity doesn't vary with the sequence in whic h the no.'s are entered.
"Varying capacity depending on the sequence of items" ?
Shouldn't this be: "Varying capacity depending on the number of items" ?
If I'm right here, your need a linked list.
If not, what do you mean?
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error in accessing structure variable in kernel modules dypgrp Programming 3 01-17-2005 07:42 AM
Wait Free Data Structure neo_119 Programming 0 11-27-2004 01:44 AM
Undefined reference Error in list data structure ashwinipahuja Programming 1 04-29-2004 05:11 PM
Harddisk capacity ilengna Linux - Hardware 4 10-14-2003 08:37 PM
perl - writing a data structure to a file.. is it possible? paavaka Programming 4 07-14-2001 12:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration