What is Data Structure?
Data Structure is used to organize, process, retrieve and store data. Data structure makes it easy for users to access and work with the data they need in appropriate ways. The data structure is a storage that is used to store and organize data. It is a way of arranging data on a computer so that it can be accessed and updated efficiently.
Types of Data Structure
Primitive Data Structure
Integer
An integer is defined as a whole number, not a fraction number, the integer number can be a positive, negative, or zero number. such as 10, 11, 0, -7, -67, and 5148 are all integers. integer numbers can’t have decimal places. When two integer numbers are added, subtracted, or multiplied, the result always comes as an integer.
Float
Float is used to define the variable with a fractional value. The numbers created using float variable declaration will have decimal points, which means have to digits on both sides of a decimal point.
Char
The character represents letters and symbols like b, f, r , -, and whitespace. It can store the basic character set and hold one letter or symbol.
Pointers
A pointer represents a storage location in memory (RAM). RAM contains many cells and the values are stored in these cells. each cell in memory is 1 byte and the memory address is always an unsigned integer, therefore, each cell has a unique address to identify it.
Non-Primitive Data Structure
Linear Data Structure
If all of the elements are arranged in a linear order, is called Linear Data Structure. The elements are stored in a non-hierarchical way where each element has successors and predecessors except the first and last elements.
1. Array
An array is defined as a collection of items stored at contiguous memory locations. It can store more than one data item that has a similar data type. It is one of the simplest data structures where each data element can be randomly accessed by using its index number.
There are three types of arrays:
One-dimensional array
Two-dimensional array
Three-dimensional array
2. Linked List
A List is defined as a collection of a variable number of data items. The element is not stored at contiguous memory locations. The element is linked using pointers. A linked list consists of a data element known as a node. And each node consists of two fields: one field has data, and in the second field, the node has an address that keeps a reference to the next node.
There are 4 types of linked lists:
Singly Linked List
Doubly Linked List
Circular Linked List
Circular Doubly Linked List
3. Stack
A stack is a collection of elements represented by a real physical stack or pile. liner data structure features insertion and deletion of items that take place at one end called the top of the stack.
In these structures data is set as a stack of books or plates, in the stack, you can remove the item from the top order. you can use these concepts or structures all throughout programming. the implementation of the stack also known as LIFO (Last in First Out).
There are two types of Stack:
Register Stack
Memory Stack
4. Queue
The queue is an ordered list that enables insert operations at one end and delete operations at another. The insert operation is performed called REAR and the delete operation is performed called FRONT. It is also called as FIFO - First In First Out list. For example, people waiting to buy a movie ticket.
There are 4 types of Queue:
Simple Queue
Circular Queue
Priority Queue
Double Ended Queue
Non-Linear Data Structure
If all the elements are not arranged in linear order i.e. each item or element is connected with two or more other items in a non-linear arrangement. The data elements are not arranged in a sequential structure.
1. Tree
Trees are used to represent a hierarchical relationship between the data elements. It is a non-linear data structure because it does not store data in sequence. The elements are arranged in multiple levels. The topmost node of the tree is called Root or Parent node and other nodes are called its child node.
There are basically 4 types of tree in data structure:
Binary Tree
Binary Search Tree
B-Tree
AVL Tree
2. Graphs
Graphs represent different types of physical design structures in Engineering science. It contains vertices and edges to connect the graph. Each node has data or information like User ID, name, gender, etc. Graphs are used to solve real-life problems involving telephone networks, circuit networks, social media networks, etc.
There are only two types of graphs:
Directed Graph
Undirected Graph
Advantages of Data Structure:
Effective and efficient processing of small and large amounts of data.
Well-organized data structures like arrays, stacks, queues, graphs, trees, etc., has well built and pre-planned approaches for operations like storage, addition, manipulation, deletion, etc.
Convenience to retrieve the data from the storage device.
Elements are stored based on index numbers in a well-organized manner.
Can easily fetch, traverse, delete and search the element from an array.
Disadvantages of Data Structure:
Require professionals to manage the operations related to the data structure.
When there is a big application or data structure to create or manipulate, you need more manpower which will increase the maintenance cost too.
Designing the Data Structure includes complex algorithms and requires much time and testing. This will also increase the maintenance cost.
Sofia Sondh
The Tech Platform
Comments