Blog about Programming Languages & Coding

Blog about Programming Languages & Coding
Contents for Computer Science, IT, B.Sc. CS & IT, M.Sc. CS & IT, MCA, BE CS & IT, ME CS & IT , Interview Questions, Books and Online Course Recommendations from Udemy, Coursera, etc

What is Data Structure?

 What is Data Structure?

As the name indicates, Data Structure is used for organizing the data in memory. There are various ways of organizing the data in the memory for eg. array, list, stack, queue and many more.

Data structure isn’t a programming language like C, C++, java, etc. It is a set of algorithms that can be used in any programming language to organize the data in the memory.

‘n’ number of algorithms were proposed to organize the data in memory. These algorithms are referred to as Abstract data types. Abstract data types are nothing but a set of rules.

Types of Data Structure – 

There are 2 types of Data Structure :

  • Primitive Data Structure

  • Non – Primitive Data Structure

Primitive Data Structure – 

Primitive Data Structures directly operate according to the machine instructions. These are the primitive data types. Data types like int, char, float, double, and pointer are the primitive data structures that can hold a single value.

Non – Primitive Data Structure – 

Non-primitive data structures are complex data structures that are derived from primitive data structures. Non – Primitive data types are further divided into two categories.

  • Linear Data Structure

  • Non – Linear Data Structure



1. Arrays

An array is a structure of fixed-size, which can hold items of the same data type. It can be an array of integers, an array of floating-point numbers, an array of strings or even an array of arrays (such as 2-dimensional arrays). Arrays are indexed, meaning that random access is possible.


2. Linked Lists

linked list is a sequential structure that consists of a sequence of items in linear order which are linked to each other. Hence, you have to access data sequentially and random access is not possible. Linked lists provide a simple and flexible representation of dynamic sets.


3. Stacks

stack is a LIFO (Last In First Out — the element placed at last can be accessed at first) structure which can be commonly found in many programming languages. This structure is named as “stack” because it resembles a real-world stack — a stack of plates.

4. Queues

queue is a FIFO (First In First Out — the element placed at first can be accessed at first) structure which can be commonly found in many programming languages. This structure is named as “queue” because it resembles a real-world queue — people waiting in a queue.


5. Trees

tree is a hierarchical structure where data is organized hierarchically and are linked together. This structure is different from a linked list whereas, in a linked list, items are linked in a linear order.

Various types of trees have been developed throughout the past decades, in order to suit certain applications and meet certain constraints. Some examples are binary search tree, B tree, treap, red-black tree, splay tree, AVL tree and n-ary tree.

6. Graphs

graph consists of a finite set of vertices or nodes and a set of edges connecting these vertices.

The order of a graph is the number of vertices in the graph. The size of a graph is the number of edges in the graph.

Two nodes are said to be adjacent if they are connected to each other by the same edge.


What is Data Structure? What is Data Structure? Reviewed by Asst. Prof. Sunita Rai on January 31, 2022 Rating: 5

No comments:

Powered by Blogger.