To understand data structure first you need to know what are abstract data types.
Some of the abstract data types are stack, queue, link list, tree etc.
Abstract data types is just a concept that defines a data type logically. It tells what operations can be performed on the data but it doesn’t tell how those operations will be performed. There are operations associated with every abstract data type.
Lets take the example of stack. Two common operations you can perform on the stack are:
Push – Inserting elements into the stack.
Pop – Deleting elements from the stack.
But how are we going to implement these operations or how are we going to implement an abstract data type ?
The answer is data structure.
Data structure is a programming construct used to implement an abstract data types. It is the physical implementation of abstract data type. All operations specified in abstract data type are implemented through data structure.
So abstract data type tells us what is to be dome and data structures tells us how to do it.
Some of the abstract data types are stack, queue, link list, tree etc.
Abstract data types is just a concept that defines a data type logically. It tells what operations can be performed on the data but it doesn’t tell how those operations will be performed. There are operations associated with every abstract data type.
Lets take the example of stack. Two common operations you can perform on the stack are:
Push – Inserting elements into the stack.
Pop – Deleting elements from the stack.
But how are we going to implement these operations or how are we going to implement an abstract data type ?
The answer is data structure.
Data structure is a programming construct used to implement an abstract data types. It is the physical implementation of abstract data type. All operations specified in abstract data type are implemented through data structure.
So abstract data type tells us what is to be dome and data structures tells us how to do it.
Linear and Non Linear data structures:
In Linear data structure the elements are in linear order. Each element except the first and the last one has a successor and predecessor. For example stack and queue.A data structure is Non-Linear if elements are not arranged in linear order. For example tree and graph.
Static and dynamic data structures:
Static and dynamic data structures:
In static data structures memory is allocated at compilation time because of this their size is fixed and cant be changed during run time.
Dynamic data structure: Memory is allocated at run time. The size of these data structures is flexible.