Skip to content

ZAKPRO786/cpp-dsa-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ DSA Practice

This repository contains my solutions to various Data Structures and Algorithms problems in C++, largely sourced from LeetCode. The problems are categorized by topic to facilitate structured learning.

Repository Structure

CPP-DSA/
├── Arrays/
│   ├── two_sum.cpp
│   ├── max_subarray.cpp
│   ├── move_zeroes.cpp
│   ├── merge_sorted_array.cpp
│   ├── best_time_stock.cpp
│   └── contains_duplicate.cpp
├── Strings/
│   ├── longest_substring.cpp
│   ├── valid_anagram.cpp
│   └── reverse_string.cpp
├── Hashing/
│   ├── subarray_sum_k.cpp
│   └── longest_consecutive.cpp
├── Stack/
│   └── valid_parentheses.cpp
├── BinarySearch/
│   ├── binary_search.cpp
│   └── search_rotated_array.cpp
├── Heap/
│   ├── kth_largest.cpp
│   └── top_k_frequent.cpp
├── DP/
│   └── climbing_stairs.cpp
├── BitManipulation/
│   ├── single_number.cpp
│   ├── power_of_two.cpp
│   ├── missing_number.cpp
│   └── count_bits.cpp
├── LinkedList/
│   ├── reverse_linked_list.cpp
│   ├── linked_list_cycle.cpp
│   └── merge_two_sorted_lists.cpp
├── Trees/
│   ├── invert_binary_tree.cpp
│   └── maximum_depth.cpp
└── Graphs/
    └── number_of_islands.cpp

Topics & Programs

Arrays

  • Two Sum: Find two numbers that add up to a target sum.
  • Maximum Subarray: Find the contiguous subarray with the largest sum.
  • Move Zeroes: Move all 0s to the end while maintaining order.
  • Merge Sorted Array: Merge two sorted arrays.
  • Best Time to Buy and Sell Stock: Maximize profit from a single transaction.
  • Contains Duplicate: Check if an array contains duplicate elements.

Strings

  • Longest Substring Without Repeating Characters: Find the longest unique substring.
  • Valid Anagram: Check if two strings are anagrams.
  • Reverse String: Reverse an array of characters in-place.

LinkedList

  • Reverse Linked List: The most famous pointer manipulation interview question.
  • Linked List Cycle: Use Tortoise and Hare pointers to find loops.
  • Merge Two Sorted Lists: Combine two sequentially ordered lists together.

Trees

  • Invert Binary Tree: The classic recursive tree traversal problem.
  • Maximum Depth of Binary Tree: Learn the base case down to leaf nodes.

Graphs

  • Number of Islands: Master Depth First Search (DFS) on 2D grids.

Hashing

  • Subarray Sum Equals K: Count subarrays that sum to K.
  • Longest Consecutive Sequence: Find the length of the longest consecutive sequence.

Stack

  • Valid Parentheses: Determine if a string of brackets is validly matched.

Binary Search

  • Binary Search: Classic binary search on a sorted array.
  • Search in Rotated Sorted Array: Find element index in a rotated array in O(log N).

Heap / Priority Queue

  • Kth Largest Element in an Array: Find the Kth largest element.
  • Top K Frequent Elements: Return the K most frequent elements.

Dynamic Programming (DP)

  • Climbing Stairs: Find ways to climb a staircase (Fibonacci sequence).

Bit Manipulation

  • Single Number: Find the number that does not appear twice.
  • Power of Two: Check if an integer is a power of two.
  • Missing Number: Find the single missing number in a range.
  • Counting Bits: Count number of 1s in binary representations up to N.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages