web analytics

Explain different types of data structures.

Data structure means how the data is organized in memory. There different kind of data structures. Some are used to store the data of same type and some for different types of data. Different types of data structures help different types of operations of data structures too. Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.

Different Types of Data Structures:

Arrays:

The simplest type of data structure is a linear array. It means a list of finite number n of elements referenced respectively by a set of n consecutive numbers, usually 1,2,3,…,n. If we choose the name A for the array then the elements of A are denoted by subscript notation as a1, a2, a3,…, an , or by parenthesis notation A(1), A(2), A(3),…, A(n) or by bracket notation A[1], A[2], A[3],… ,A[n]. For example, considering the following array named STUDENTS containing 6 student names,

STUDENTS
1
Tanmay
2
H
3
E
4
A
5
B
6
C

Here, STUDENTS[1] = Tanmay, STUDENTS[2] = H and so on.

Linked List: 

In computer science, a linked list is a data structure that consists of a sequence of data records such that in each record there is a field that contains a reference (that is, a link) to the next record in the sequence. In other words, A simple linear data structure, each of whose nodes includes pointers to the previous and subsequent nodes in the list, enabling traversal of the structure from any starting point. For example, considering following two lists.


These are list of patients and doctors indicating which patient met which doctors and which doctors saw which patient. For example, if we select Tanmay then the corresponding pointers are 1 and 3 and these are the index number of the Doctor list. Thus, Tanmay met S and N. Again if we select Sh from the Doctor list, it has 4,5 and 6 and these are the index of the patient list, thus Sh saw the patients B, C and D.

Trees:

Data frequently contain a hierarchical relationship between various elements. The data structure which reflects this relationship is called a rooted tree graph or simply a tree. This is sometimes like the properties of an object. For example, properties to store of an employee in the office directory can be name, age, sex, salary etc. Again the properties “name” can have sub-properties like first name, middle name, last name etc. This can be showed as follows.

Read More: What is Tree in Data Structure? Explain different types of trees.




Continue Reading to the next part.

Stack:

A stack, also called a Last-In-First-Out (LIFO) system, where insertion and deletion can take place only at one end called the top. This structure is similar in its operation to stack of dishes in a spring system as in the following figure.



Queue:

A queue, also called a First-In-First-Out (FIFO) system is a linear list where deletions will take place only at the front end and insertions will take place only at the rear end. In the following figure we can see a pipe with two ends, left end is the rear end and right end is the front end. We are inserting some balls and those balls can only be inserted from the rear and they can come out (deletions) from the front end.

Thank you. Take a moment to share 🙏