Introduction - DSA #01



What is Data Structure?

In order to understand, what is a data structure we have to first clear what is an abstract datatype. It is something that is the base for a data structure.

So, What is an Abstract Data Type?

Assuming that you are aware of the basic of programming, you may have used data types i.e. integer, float, char or string. These are the data types that have some specific properties and some predefined operations. For example, we can use addition, subtraction and multiplication on integer datatype. If we draw the model of integer data type, here is what we will get here.

Integer Model

As you can see an integer data type's model is explaining integer data type's properties and operations. But there are no implementation details. We can't figure our how all these operations work. That's what an Abstract Data Type is. 

In Abstract Data Type is a mathematical model with a collection of operations defined on that model, and with no implementation details.

or 

An Abstract Data Type is the specification of a data in some language, independent of an implementation.




Examples are Integer, Array, List, Map, Queue etc.


Real Life Example: A book is an abstract. It doesn't tell us anything about itself. We can't figure out whether it is a story book, a text book or a telephone book. Where a Telephone book is an implementation. Because now we know that it is a telephone book and what and what kind of content is in it.


Detailed Examples:

    let's assume we have a C++ file containing the following code.

    int x = 34;

    As you can see, we don't need the implementation of this datatype because its     an abstract datatype. Now, let's move on to the Data Structure.


What is a Data Structure?

     Data Structure is simply the implementation of ADT (Abstract Data Type). Now, you might be thinking that how the integer data type is gonna be implemented?. The answer is we will use those int or any other ADT to build our own Data Structure. If you have worked with OOP (Object Oriented Programming), you might have the idea already. 

Data Structures are used to store data in a computer in an organized fashion. We structure our data as we want. So, we can access it easily.

Example:

Arrays, Stacks, Queues, Linked Lists, Trees, Graphs, Hash Tables etc.


Now let's move on to the Big-O...

Introduction - DSA #01 Introduction - DSA #01 Reviewed by Tayyab Mughal on August 18, 2020 Rating: 5

No comments:

Thanks For Your Comment!

Powered by Blogger.