My DSA

Welcome to the Data Structures and Algorithms (DSA) repository. This document provides an overview of key data structures and examples implemented in Java.

Key Concepts

Data Structures and Algorithms are crucial for:

  • Efficient Data Storage and Retrieval
  • Optimizing Performance
  • Effective Problem Solving

Data Structures

Here is a list of common data structures:

  1. Array

    -Largest in array

    -Second Largest in Array

    -Check if Array is Sorted

    -Remove Duplicates from Array

  2. Linked List

  3. Stack

  4. Queue

  5. Hash Table

  6. Tree

    • Binary Tree
    • Binary Search Tree (BST)
  7. Heap

  8. Graph

Java Examples

Array

// Array
int[] array = {1, 2, 3, 4, 5};

Linked List Node

// Linked List Node
class Node {
    int value;
    Node next;
    
    Node(int value) {
        this.value = value;
        this.next = null;
    }
}

Stack

import java.util.Stack;
 
// Stack
Stack<Integer> stack = new Stack<>();

Queue

import java.util.LinkedList;
import java.util.Queue;
 
// Queue
Queue<Integer> queue = new LinkedList<>();