DEV Community

Mehfila A Parkkulthil
Mehfila A Parkkulthil

Posted on

Day 1 : Introduction of DSA

Hey everyone!
I'm excited to announce that I'm starting a blog series focused on Data Structures and Algorithms (DSA). I'll be sharing tutorials based on what I've learned and know.
I'll be using the C++ language for these tutorials, and I'll also be posting C++ language tutorials for those who are new to it.


While DSA can be solved either using C++ , Java or Python.

Data structures


Here I am using C++ .

So guys this is just an introduction , you don't need to worry if you don't understand I will be covering these topics on upcoming blogpost.
This is just to make sure that these are the topics we are gonna cover.
If you are new to C++ I would suggest first its must to know C++ if you are known with java , thats fine.
Yes, my blogs are structured to help you learn both C++ and DSA simultaneously..


Primitive Data Structure

Primitive data structures are the most basic forms of data representation in programming languages.
Here are the common primitive data structures:

  1. Integer (int)
    Represents whole numbers without any fractional part.
    Examples: -1, 0, 4

  2. Floating-Point (float, double)
    Represents real numbers with fractional parts, using a fixed number of decimal places.
    Examples: 3.14, -0.001, 2.71828

  3. Character (char)
    Represents a single character from a character set, typically written in quoted commas.
    Examples: 'a', 'Z', '9', '#'

  4. Boolean (bool)
    Represents a binary value that can be either true or false.
    Examples: true, false
    Used in conditional statements, loops, and to represent binary states.

  5. Strings (string)
    Represents a sequence of characters, typically used to store text and written in quotation.
    Examples: "Hello, World!", "Python", "12345"

#include <iostream>
using namespace std;
int main() {

    // Integer
    int age = 25;
    cout << "Age: " << age << endl;

    // Floating-Point
    float pi = 3.14;
    cout << "Pi: " << pi << endl;

    // Character
    char grade = 'v';
    cout << "Grade: " << grade << endl;

    // Boolean
    bool isgirl = true;
    cout << "Is Girl: " << isgirl << endl;

    // String
    string name = "Aiera";
    cout << "Name: " << name << endl;

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Non - Primitive Data Structures

Non-primitive data structures, also known as composite or user-defined data structures, are more complex than primitive data structures.

They are built using primitive data structures and can store a collection of values, allowing for efficient data management and manipulation.

  • Arrays: A collection of elements, typically of the same type, stored in contiguous memory locations.

  • Linked Lists: A sequence of elements, where each element points to the next one, allowing for dynamic memory allocation.

  • Stacks: A linear data structure that follows the Last In, First Out (LIFO)
    Example:Think of it like a stack of plates: you add and remove plates from the top.

  • Queues: A linear data structure that follows the First In, First Out (FIFO) principle.
    Example:Imagine a line of people waiting for a bus: the first person in line is the first one to get on the bus.

  • Trees: A hierarchical data structure with a root element and child elements, used to represent hierarchical relationships. Common types include binary trees and binary search trees.

  • Graphs: A collection of nodes (vertices) connected by edges, used to represent networks, such as social networks or computer networks.

  • Tables: A data structure that stores key-value pairs, using a hash function to compute an index into an array of buckets or slots.

Top comments (0)