Data Structure
The data structure represents the logical link between individual Items for collection.
The data structure is a technique of arranging all collection components that not only take into account the stored elements but also their interaction.
We may also describe the data structure as a mathematical or logical model for a certain data array.
A storage device is termed the representation of the particular arrangement of facts in the principal memory of a computer.
The representation of the storage structure is termed file structure in the auxiliary memory.
It is described as the method in which data are stored and manipulated in a structured form to be efficiently utilized.
The data structure defines basically the following four elements
- Organization of Data
- Accessing methods
- Degree of associativity
- Processing alternatives for information
- Algorithm + Data Structure = Program
- Data structure study covers the following points
- Amount of memory require to store.
- Amount of time require to process.
- Representation of data in memory.
- Operations performed on that data.
Data structure operations
There are the following 8 operations on data structure as given below.
Creation: The creation of an integrated array of 5 values according to the criteria example. int ar[5]; //ar is the name of array
Insertion: Insert data structure values. The input of items into the arrangement of facts is possible in three ways: first, at the end, and at the appropriate location.
Traversal: At least once you visit each element of the arrangement of facts.
Search: Search for an element in the number of items specified. There are two approaches to search for the elements:
a. Linear Search: Easy approach to search an item.
b. Search Binary: works on the law of division and conquest.
Sorting: In a specific order rearranging the elements, ascending or descending. Multiple sorting algorithms exist:
a. Bubble Sort
b. Selection Sort
c. Quick Sort
d. Merge Sort
e. Heap Sort
Merging: Combining in a single file the data elements of two sort files.
Updating: Update the current value with a new value in the program.
Deletion: Deletion from the arrangement of facts of the undesirable value. There are three techniques to remove a program value. These are: from the start, from the finish, and from the particular place.
Linear data structures
A data structure is known as Linear if its elements are logically or sequence-based linked linearly.
There are two ways to display linear memory storage,
Attribution of static memory
Memory assignment dynamic
The available operations for the linear data structure are: cross, insert, delete, search, sort, and merge.
The Stack and Queueue are examples of the Linear Arrangement of facts.
Stack: A stack is a arrangement of facts in which only one end is inserted and deleted.
The insertion procedure is called “PUSH” while the removal operation is called “POP.”
In First Out, the stack is also called Last.
Queue: The Data Structure that allows one end to insert and another end to delete, known as Tail.
The end of the deletion is called the FRONT end and a further end is known as the REAR end for insertion.
As first in first out Arrangement of facts (FIFO), the queue is also termed.
Nonlinear data structures
Nonlinear data structures are the data structures that do not arrange data elements in one sequence.
Tree and graph are examples of the non-linear arrangement of facts.
- Tree: A tree may be described as a finite set of data elements (nodes) where data items are organized according to requirements in branches and sub-branches.
- Trees indicate the link between different parts of the hierarchy.
- Tree consists of nodes linked to the circle, the node represented by the circle, and the edge.
-
- Graph: The graph is a node collection (Information) and a linkage between the nodes (Logical relationship).
- You may visualize a tree as a limited graph.
- There are numerous sorts of graphs:
- Un-directed Graph
- Directed Graph
- Mixed Graph
- Multi Graph
- Simple Graph
- Null Graph
- Weighted Graph
Difference between Linear and Non Linear Data Structure
Linear Data Structure | Non-Linear Data Structure |
Each object has to do with its past and its upcoming time. | Each thing has several additional objects attached. |
Data in a linear series is organized. | There is no sequence of data. |
In a single run, data items can be crossed. | In a single run, the data cannot be crossed. |
Eg. Array, Stacks, linked list, queue. | Eg. tree, graph. |
It’s easy to implement. | It’s difficult to implement. |