LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   data structure with variable capacity (https://www.linuxquestions.org/questions/programming-9/data-structure-with-variable-capacity-284369/)

shivaligupta 01-31-2005 03:30 AM

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.

ilikejam 01-31-2005 03:56 AM

A 'linked list' does what you're looking for.

Dave

Hko 01-31-2005 11:54 AM

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?


All times are GMT -5. The time now is 10:40 PM.