By: Archana Shukla and Rajesh Shukla
Introduction To Data Structures
Data structures are a way of organizing and storing data so that they can be accessed and worked efficiently. They define the relationship between the data and the operations that can be performed on the data.
A data structure is a named group of data of different data types which is stored in a specific way and can be processed as a single unit. A data structure has well-defined behavior and properties.
Data Type vs. Data Structure:
A Data type defines a set of values along wiht well defined operations stating its input output behaviour. e.g we cannot store a floating value in an integer or two strings cannot be multiplied.
A data structure is a physical implementation that clearly defines a way of storing, accessing, manipulating data in a computer.
Types of Data Structures:
The Data Structures are classified into the following ways
(i). Primitive Data Structures / Simple Data Structures
These are the most primitive or basic data structures. They are the building blocks for data manipulation and contain pure, simple values of data. Python has four primitive variable types:
Integers, Float, Strings, Boolean
Integers
You can use an integer represent numeric data, and more specifically, whole numbers from negative infinity to infinity, like 46, 54, or -14.
Float
“Float” stands for ‘floating point number’. You can use it for rational numbers, usually ending with a decimal figure, such as 21.11 or 443.14.
String
Strings are collections of alphabets, words or other characters. In Python, we can create strings by enclosing a sequence of characters within a pair of single or double quotes.
For example: “hello”, ‘welcome’ etc.
Boolean
This built-in data type that can take up the values:
True and False
which often makes them interchangeable with the integers 1 and 0. Booleans are useful in conditional and comparison expressions.