answersLogoWhite

0

Importance of data structure

Updated: 8/10/2023
User Avatar

Wiki User

15y ago

Best Answer

Data structure is important since it dictates the types of operations we can perform on the data and how efficiently they can be carried out. It also dictates how dynamic we can be in dealing with our data; for example it dictates if we can add additional data on the fly or if we need to know about all of the data up front. We determine which data structures to use to store our data only after we've carefully analyzed the problem and know at least what it is we hope to do with the data; for example if we'll require random access, or sequential access, or the ability to move both forward and backward through the data.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

Data sturcture is the tool of various data structures like stack,queue,linked list etc. by using such data structure we are able to store the data into computer very significant manner also we retrive this sotred data very fast so that data structures helps in data operations like storing data,searching perticula data etc

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

Data structures allow efficient manipulation of data. For example, a Linked List data structure allows insertion and deletion with only a few operations, however, a standard array may take thousands or even millions of operations to move a large amount of data over by one notch; or it may require a list of holes. Also, certain data structures allow one piece of data to have relationships with many other pieces of data - allowing for much greater accessibility.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

A data structure is an aggregate of two or more data types. They allow us to combine related data into a single entity, much like a database record. Data structures are also useful when we wish to return more than one value from a function. Without data structures we'd have to use output parameters to return multiple values, but this is an ugly solution to a simple problem. Returning a single data structure containing the values is more elegant and intuitive.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Just as a car is not the same as an airplane, nor is your name the same type of data as your age (a "string" versus a "number"), different types of data structures allow programmers to model different types of data they wish to represent.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

Data structures are vital in programming. When we have two or more variables that are in some way related to each other, it is convenient to create an aggregate from those variables such that we can treat them as if they were a single entity. For instance, when referring to a point on a two-dimensional graph, we require an x and a y coordinate; two separate variables:

int x, y; // coordinates of a point on a graph

While this is usable, the only thing that actually defines the relationship between x and y is a user-defined comment. But compilers don't read comments let alone understand them; as far as the compiler is concerned, x and y are completely separate and unrelated variables. Thus the comment merely helps other programmers, but the onus is placed on those other programmers to actually read the comment. Given that comment may only appear in one place, it is up to those programmers to actually seek it out and thus understand what the variables x and y actually mean within the context in which they are used.

Data structures allow us to consolidate the relationship between otherwise separate variables. In this case, x and y refer to a single point, therefore we should define a type that reflects that concept:

struct point {

int x, y;

};

The relationship between x and y is now defined by the fact they are members of a point structure. The compiler knows this and a human reader can more easily deduce the purpose of a point without the need for a user-defined comment.

When we define a structure we are, in fact, defining a new data type; a type that we can pass to functions and return from functions just as easily as we can any primitive data type, like int and char. Given that a structure may have more than one member, this also makes it possible for functions to return more than one value.

A structure may contain as many members as required but the members need not be of the same type. For instance, we might define an employee as follows:

struct employee {

int employee_num;

int department_num;

char* first_name;

char* middle_names;

char* last_name;

};

Since a data structure is a type, data structures may contain other data structures as members. In the above example we might decide that the name members would be useful in other structures, thus we can separate them out:

struct name {

char* first_name;

char* middle_names;

char* last_name;

};

Now our employee structure can be simplified:

struct employee {

int employee_num;

int department_num;

name employee_name;

};

We can then use the name type in another structure:

struct customer {

int customer_num;

name customer_name;

};

Thus data structures allow us to create complex data types from primitive data types.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

data structure tells us to make our programs efficient and fast to execute.

and also how the structure of data should be.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

data structure tells us to make our programs efficient and fast to execute.

and also how the structure of data should be.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

What is data structure

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Importance of data structure
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions