Skip to content

This repository contains implementations of common algorithms and Leetcode problems in C++.

Notifications You must be signed in to change notification settings

saifiimuhammad/Data-Structures-Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Data Structures and Algorithms

This repository contains implementations of common algorithms in C++. Below is a brief overview of each algorithm, its time complexity, and typical usage scenarios.

Sorting Algorithms

  1. Bubble Sort

    • Time Complexity: O(n²)
    • Usage: Simple but inefficient, used for small datasets or educational purposes.
  2. Selection Sort

    • Time Complexity: O(n²)
    • Usage: Better than bubble sort for small datasets, useful for learning purposes.
  3. Quick Sort

    • Time Complexity: O(n log n) on average
    • Usage: Efficient for large datasets; performance may degrade with bad pivot choices.
  4. Merge Sort

    • Time Complexity: O(n log n)
    • Usage: Stable and consistent, ideal for large datasets where stability is required.
  5. Insertion Sort

    • Time Complexity: O(n²)
    • Usage: Efficient for small datasets and nearly sorted data.

Problem-Solving

  1. Two Sum Problem

    • Description: Find two numbers that add up to a target value.
    • Time Complexity: O(n)
    • Usage: Common problem in coding interviews.
  2. Counter Problem

    • Description: Count occurrences of elements in an array.
    • Time Complexity: O(n)
    • Usage: Useful for frequency counting.
  3. Remove Duplicates

    • Description: Remove duplicates from a sorted array.
    • Time Complexity: O(n)
    • Usage: Simplifies an array by removing duplicate values.

Credits

Developed by Muhammad Saif.

About

This repository contains implementations of common algorithms and Leetcode problems in C++.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages