why do we need data structures, if it is a way of storing data in computer in an efficient way, then the computer itself has the ability to store the data in an efficient way, why do we create linked lists n other stuffs. why do we use stacks,trees n other stuff in c???

Recommended Answers

All 5 Replies

Each structure has it's advantages - and disadvantages. It's like what you drive. You'd want a race car for racing (great for speed and handling), but a diesel truck for towing (loads of low end torque), the heavy loads.

Like Adak said, each structure has it's advantage and disadvantage; the analogy was spot on. Not all forms of data storage is acquit for every scenario.

actually, my question was different. i meant that why do we need to use data structure?

>i meant that why do we need to use data structure?
That's the same question you asked originally. Clearly you're not expressing your question in a way that can be understood, so try rewording it.

data structures organise data and store it in an efficient way. You don't want data to be cluttered and disorganised, do you?
also, we want to make maximum use of disk space and we also want the data access time to be as low as possible. But both of these requirements are hard to be met in one data structure.
some data structures provide minimum access time, while other use space judiciously. hence we can use the appropriate data structure according to our requirements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.