What is Data?
Data is everywhere, every second our mind process roughly around 11 million bits of data. Even when you talk about programming or just say computer science Data is in its core. Everything revolves around data. So, lets start by defining data.
Data is a collection of raw facts, figures, observations, statistics or any discrete value. Example - colour, person age, phone number, or anything you can imagine.
Own its own data has no significance unless organised together to conceptualise information. Lets understand with example.
Blue colour is a data. If I just say blue it may not signify anything.
However, when we say "The sky is blue". It has a meaning now and is an information.
Now, in order to work with these data. We need to define a system, to group several data in various bucket and specify rules to work with each of these groups. Example - You can perform arithmetic operations on numeric data (2, -5, 0.6 etc.) but not on a string type ("blue", "codeforwin"). Let's name this system as Data Type.
What is Data Type?
Data Type is a system to define basic properties and operations allowed on the data. Properties such as - acceptable values, range, bytes required in memory etc.
We can categorize data types broadly in three categories -
- Primitive Data Type (or built-in data type)
Standard data types that comes built-in with a programming lanaguge from which other data types are composed is known as primitive data type. In general -int
,float
,boolean
andchar
are considered as common primitive types. Primitive data type are atomic in nature, mean they accept single data value which cannot be further broken down. - Composite Data Type (or user-defined or non-primitive data type)
Data type created from collection of primitive and/or other composite type is referred as composite data type. Composite data types are not atomic in nature. Meaning values of composite type can be accessed individually. Example -array
,structure
,class
etc. - Abstract Data Type (ADT)
As the name goes "Abstract", the ADT does not define a concrete representation of data. Rather it specifies the operation performed on the data type. Example -List
,Queue
,Set
etc.
What is Data Structure?
In computer science "Data Structure" is the way of data arrangement in memory and applying some operations to perform actions on the data.
Throughout the course of time we have formalised several data structures catering different use cases. Choosing a proper data structure while designing algorithms is crucial for its efficiency. Let us learn some of the important data structures.
- Array
- List
- Stack
- Queue
- Set
- Graph
- Tree
Data Structures classification?
Depending of the way of data organization, data structures can be classified as -
- Linear Data Structure - Elements are either stored or accessed sequentially. Example - Array, LinkedList, Stack, Queue etc.
- Non-Linear Data Structure - Elements are neither stored nor accessed sequentially. Example - Tree, Graph etc.