In: Computer Science
What are the data structures. How these are useful in different fields of computer science. Discuss at least three fields.
Data: Data is organised information which is to be kept in a computer system. Like there are documents, files, information taken through in internet and many more.
This data should be present in an organised form so that it can stored in the computer devices and can be easily created. accessed, modified, deleted.
Structure: Structure is a combination of some procedures which enable creation, access, updating and deletion of the data in an efficient way.
This data can be organised in a different way. That’s become type of data structure.
Data Structure: Data structure is defined as a logical and mathematical model of particular organisation of a data. Then how-to implementation that structure and then analysis of that structure.
Example of data structure:
1>Array: It linear organisation of data. Data in array stores at contiguous memory allocation. Size of array is defined initially. Elements in array are accessed via index value:
int a[10];
Here a is the name of array, int is data type of array means which type of data is going to be stored in array. 10 is the size of array.
Elements are accessed via index. Let i is the index, then a[i] will denote the ith element of the array.
2>Linked List: It is a list which contains elements as per the data type. It is different from array because here elements are not stored at contiguous memory location. Here pointer indicate the address of the next element.
3>Stack: It store elements in the form of stack e.g. stack of plates. It is FILO( First in last out). The first element which was put on the stack is the last element to be deleted. Push is used for insertion and pop is used for deletion. Array and linked list are used for its implementation.
4>Queue: It is store element in the form of queue e.g. queue for ticket at metro station. It is FIFO( First in first out). The first element is the one who is going to be deleted first. Here front is used for first element and rear is used for last element. Array and linked list are used for its implementation.
5>Trees: It hierarchal data structure like tree. It has leaf nodes and one root node. Which are called as parent and child nodes. Array and linked list are used for its implementation.
6>Graph: It not necessarily hierarchical in nature. Array and linked list are used for its implementation.
Image is attached for overview of these data structure:
Operations on Data Structure:
1>Traversing: Access each and every element at least once.
2>Searching: Search the given item in the data structure.
3>Inserting: Adding new item to the data structure.
4>Deleting: Removing particular item from the data structure.
5>Sorting: Sort the data structure like ascending order or descending order.
6>Merging: Merge two list into the single list.
Data structure are useful in different fields of computer science for example graphs are used in goggle maps, Facebook operating system etc.
Every data structure has its own use according to his operation and structure. Array has its own use like in games. Liked list is used in several applications like music player. Stack is used in undo redo and also in web browser for next and previous page. Queue is used in operatinf system for scheduling of processes. Graph is used in operating system for resouce allocation graph and also used by google maps. Tree data structyre is used to manage file system.
Machine learning language is also use data structure. It is also used in indexing. Srcipting language also make use of data structure.
Below are the four application that uses data structure:
1> Google maps:
Use graph data structure:
As graph has vertex and edge. This concept is used in google map to indicate the transportation system. Intersection of two roads is defined as vertex and the length of road is called as edge. Now an algorithm is built to find out the shortest path between two vertices. This shortest route is shown to us while travelling from source to destination. And vertices among the travelling are also shown which indicate the direction of travelling.
2>Operating system:
Use graph data structure:
Operating system use graph to build resource allocation graph. Which resource is used by which process is indicated through graph? Here vertex is defined as resource and process and direction of edges defines the allocation means which resource is used by which process.
Use tree data structure:
File system on computer is the best example for tree data structure. Files and folder are stored in the form tree. Folder within folder is made as a child of the folder. And upper folder is called then the parents.
Use of Queue data structure:
Queue are used for scheduling process in the operating system like first come first bases, priority bases, time slice bases etc.
3>Domain name system:
Use of tree data structure:
Domain name system use tree data structure for storing domains names. Because DNS uses a hierarchy for managing data basses. DNS is divided into top level domains and into subdomain with the help of tree. Parent child relationship is present.
4>Music and picture player:
Use of Linked list data structure:
1>Image viewer: Image viewer software use linked list. In this one image is connected with the other means what is the next image to be displayed is stored via linked list.
2>Music player: It stores the play list in the similar way as images are stored. Previous song decides which is the next song on the list to be played.
The applications of data structure is very vast. Where there is computer science, there is data stucture in one or another way.