# 5hraddhab/dsa architecture

> Architecture diagram of the GitHub repository 5hraddhab/dsa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/5hraddhab/dsa
- Repository: https://github.com/5hraddhab/dsa

## Overview

This repository is a collection of standalone C++ algorithm examples, not a single application. Its principal user-to-result pattern is to provide an input to an individual solution or demonstration and obtain a computed result or traversal output. The examples cover array and string problems, trees and linked lists, graph traversal, recursion, and stack/queue implementations. They do not show shared runtime orchestration or calls between examples, so the graph groups independent components without inventing a pipeline. Relationships are omitted because no inter-component calls are evidenced.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arrays["Arrays and Strings"]
  node_two_sum["Two Sum<br/>[two-sum.cpp]"]
  node_pascal_triangle["Pascal Triangle"]
  node_pascal_row["Pascal Row"]
  node_stock_profit["Stock Profit"]
  node_longest_consecutive["Longest Consecutive"]
  node_majority["Majority Element"]
  node_four_sum["Four Sum<br/>[4sum.cpp]"]
  node_truck_units["Truck Units"]
  node_majority_ii["Majority Element II"]
  node_single_number["Single Number III"]
  node_duplicate_number["Find Duplicate"]
  node_next_permutation["Next Permutation"]
  node_missing_repeated["Missing and Repeated"]
  node_rotate_image["Rotate Image<br/>[rotate-image.cpp]"]
  node_max_subarray["Maximum Subarray"]
  node_subarray_sum["Subarray Sum"]
  node_set_matrix_zeroes["Set Matrix Zeroes"]
  node_binary_search["Binary Search<br/>[binary-search.cpp]"]
  node_atoi["String to Integer"]
  node_merge_sorted["Merge Sorted Arrays"]
end

subgraph group_trees["Trees and Lists"]
  node_max_depth["Tree Max Depth"]
  node_max_path["Maximum Tree Path"]
  node_list_cycle["Linked List Cycle"]
  node_list_intersection["List Intersection"]
  node_kth_bst["Kth BST Value"]
  node_delete_bst["Delete BST Node"]
  node_bst_search["Search BST"]
  node_bst_insert["Insert BST"]
  node_validate_bst["Validate BST"]
end

subgraph group_graphs["Graph Algorithms"]
  node_graph_bfs["Breadth-First Search<br/>[BFS.cpp]"]
  node_graph_dfs["Depth-First Search<br/>[DFS.cpp]"]
  node_graph_creation["Graph Creation<br/>[graphcreation.cpp]"]
end

subgraph group_recursion["Recursion"]
  node_permutations["Permutations<br/>[permutations.cpp]"]
  node_power["Power Function<br/>[powx-n.cpp]"]
end

subgraph group_stacks["Stacks and Queues"]
end

click node_two_sum "https://github.com/5hraddhab/dsa/blob/main/1-two-sum/two-sum.cpp"
click node_max_depth "https://github.com/5hraddhab/dsa/blob/main/104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.cpp"
click node_pascal_triangle "https://github.com/5hraddhab/dsa/blob/main/118-pascals-triangle/pascals-triangle.cpp"
click node_pascal_row "https://github.com/5hraddhab/dsa/blob/main/119-pascals-triangle-ii/pascals-triangle-ii.cpp"
click node_stock_profit "https://github.com/5hraddhab/dsa/blob/main/121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.cpp"
click node_max_path "https://github.com/5hraddhab/dsa/blob/main/124-binary-tree-maximum-path-sum/binary-tree-maximum-path-sum.cpp"
click node_longest_consecutive "https://github.com/5hraddhab/dsa/blob/main/128-longest-consecutive-sequence/longest-consecutive-sequence.cpp"
click node_list_cycle "https://github.com/5hraddhab/dsa/blob/main/141-linked-list-cycle/linked-list-cycle.cpp"
click node_list_intersection "https://github.com/5hraddhab/dsa/blob/main/160-intersection-of-two-linked-lists/intersection-of-two-linked-lists.cpp"
click node_majority "https://github.com/5hraddhab/dsa/blob/main/169-majority-element/majority-element.cpp"
click node_four_sum "https://github.com/5hraddhab/dsa/blob/main/18-4sum/4sum.cpp"
click node_truck_units "https://github.com/5hraddhab/dsa/blob/main/1829-maximum-units-on-a-truck/maximum-units-on-a-truck.cpp"
click node_majority_ii "https://github.com/5hraddhab/dsa/blob/main/229-majority-element-ii/majority-element-ii.cpp"
click node_kth_bst "https://github.com/5hraddhab/dsa/blob/main/230-kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst.cpp"
click node_single_number "https://github.com/5hraddhab/dsa/blob/main/260-single-number-iii/single-number-iii.cpp"
click node_duplicate_number "https://github.com/5hraddhab/dsa/blob/main/287-find-the-duplicate-number/find-the-duplicate-number.cpp"
click node_next_permutation "https://github.com/5hraddhab/dsa/blob/main/31-next-permutation/next-permutation.cpp"
click node_missing_repeated "https://github.com/5hraddhab/dsa/blob/main/3227-find-missing-and-repeated-values/find-missing-and-repeated-values.cpp"
click node_delete_bst "https://github.com/5hraddhab/dsa/blob/main/450-delete-node-in-a-bst/delete-node-in-a-bst.cpp"
click node_permutations "https://github.com/5hraddhab/dsa/blob/main/46-permutations/permutations.cpp"
click node_rotate_image "https://github.com/5hraddhab/dsa/blob/main/48-rotate-image/rotate-image.cpp"
click node_power "https://github.com/5hraddhab/dsa/blob/main/50-powx-n/powx-n.cpp"
click node_max_subarray "https://github.com/5hraddhab/dsa/blob/main/53-maximum-subarray/maximum-subarray.cpp"
click node_subarray_sum "https://github.com/5hraddhab/dsa/blob/main/560-subarray-sum-equals-k/subarray-sum-equals-k.cpp"
click node_set_matrix_zeroes "https://github.com/5hraddhab/dsa/blob/main/73-set-matrix-zeroes/set-matrix-zeroes.cpp"
click node_bst_search "https://github.com/5hraddhab/dsa/blob/main/783-search-in-a-binary-search-tree/search-in-a-binary-search-tree.cpp"
click node_bst_insert "https://github.com/5hraddhab/dsa/blob/main/784-insert-into-a-binary-search-tree/insert-into-a-binary-search-tree.cpp"
click node_binary_search "https://github.com/5hraddhab/dsa/blob/main/792-binary-search/binary-search.cpp"
click node_atoi "https://github.com/5hraddhab/dsa/blob/main/8-string-to-integer-atoi/string-to-integer-atoi.cpp"
click node_merge_sorted "https://github.com/5hraddhab/dsa/blob/main/88-merge-sorted-array/merge-sorted-array.cpp"
click node_validate_bst "https://github.com/5hraddhab/dsa/blob/main/98-validate-binary-search-tree/validate-binary-search-tree.cpp"
click node_graph_bfs "https://github.com/5hraddhab/dsa/blob/main/GRAPH/BFS.cpp"
click node_graph_dfs "https://github.com/5hraddhab/dsa/blob/main/GRAPH/DFS.cpp"
click node_graph_creation "https://github.com/5hraddhab/dsa/blob/main/GRAPH/graphcreation.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_two_sum,node_pascal_triangle,node_pascal_row,node_stock_profit,node_longest_consecutive,node_majority,node_four_sum,node_truck_units,node_majority_ii,node_single_number,node_duplicate_number,node_next_permutation,node_missing_repeated,node_rotate_image,node_max_subarray,node_subarray_sum,node_set_matrix_zeroes,node_binary_search,node_atoi,node_merge_sorted toneBlue
class node_max_depth,node_max_path,node_list_cycle,node_list_intersection,node_kth_bst,node_delete_bst,node_bst_search,node_bst_insert,node_validate_bst toneAmber
class node_graph_bfs,node_graph_dfs,node_graph_creation toneMint
class node_permutations,node_power toneRose
```

## Components

### Arrays and Strings

- [Two Sum](https://github.com/5hraddhab/dsa/blob/main/1-two-sum/two-sum.cpp): `1-two-sum/two-sum.cpp`
- [Pascal Triangle](https://github.com/5hraddhab/dsa/blob/main/118-pascals-triangle/pascals-triangle.cpp): `118-pascals-triangle/pascals-triangle.cpp`
- [Pascal Row](https://github.com/5hraddhab/dsa/blob/main/119-pascals-triangle-ii/pascals-triangle-ii.cpp): `119-pascals-triangle-ii/pascals-triangle-ii.cpp`
- [Stock Profit](https://github.com/5hraddhab/dsa/blob/main/121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.cpp): `121-best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.cpp`
- [Longest Consecutive](https://github.com/5hraddhab/dsa/blob/main/128-longest-consecutive-sequence/longest-consecutive-sequence.cpp): `128-longest-consecutive-sequence/longest-consecutive-sequence.cpp`
- [Majority Element](https://github.com/5hraddhab/dsa/blob/main/169-majority-element/majority-element.cpp): `169-majority-element/majority-element.cpp`
- [Four Sum](https://github.com/5hraddhab/dsa/blob/main/18-4sum/4sum.cpp): `18-4sum/4sum.cpp`
- [Truck Units](https://github.com/5hraddhab/dsa/blob/main/1829-maximum-units-on-a-truck/maximum-units-on-a-truck.cpp): `1829-maximum-units-on-a-truck/maximum-units-on-a-truck.cpp`
- [Majority Element II](https://github.com/5hraddhab/dsa/blob/main/229-majority-element-ii/majority-element-ii.cpp): `229-majority-element-ii/majority-element-ii.cpp`
- [Single Number III](https://github.com/5hraddhab/dsa/blob/main/260-single-number-iii/single-number-iii.cpp): `260-single-number-iii/single-number-iii.cpp`
- [Find Duplicate](https://github.com/5hraddhab/dsa/blob/main/287-find-the-duplicate-number/find-the-duplicate-number.cpp): `287-find-the-duplicate-number/find-the-duplicate-number.cpp`
- [Next Permutation](https://github.com/5hraddhab/dsa/blob/main/31-next-permutation/next-permutation.cpp): `31-next-permutation/next-permutation.cpp`
- [Missing and Repeated](https://github.com/5hraddhab/dsa/blob/main/3227-find-missing-and-repeated-values/find-missing-and-repeated-values.cpp): `3227-find-missing-and-repeated-values/find-missing-and-repeated-values.cpp`
- [Rotate Image](https://github.com/5hraddhab/dsa/blob/main/48-rotate-image/rotate-image.cpp): `48-rotate-image/rotate-image.cpp`
- [Maximum Subarray](https://github.com/5hraddhab/dsa/blob/main/53-maximum-subarray/maximum-subarray.cpp): `53-maximum-subarray/maximum-subarray.cpp`
- [Subarray Sum](https://github.com/5hraddhab/dsa/blob/main/560-subarray-sum-equals-k/subarray-sum-equals-k.cpp): `560-subarray-sum-equals-k/subarray-sum-equals-k.cpp`
- [Set Matrix Zeroes](https://github.com/5hraddhab/dsa/blob/main/73-set-matrix-zeroes/set-matrix-zeroes.cpp): `73-set-matrix-zeroes/set-matrix-zeroes.cpp`
- [Binary Search](https://github.com/5hraddhab/dsa/blob/main/792-binary-search/binary-search.cpp): `792-binary-search/binary-search.cpp`
- [String to Integer](https://github.com/5hraddhab/dsa/blob/main/8-string-to-integer-atoi/string-to-integer-atoi.cpp): `8-string-to-integer-atoi/string-to-integer-atoi.cpp`
- [Merge Sorted Arrays](https://github.com/5hraddhab/dsa/blob/main/88-merge-sorted-array/merge-sorted-array.cpp): `88-merge-sorted-array/merge-sorted-array.cpp`

### Trees and Lists

- [Tree Max Depth](https://github.com/5hraddhab/dsa/blob/main/104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.cpp): `104-maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.cpp`
- [Maximum Tree Path](https://github.com/5hraddhab/dsa/blob/main/124-binary-tree-maximum-path-sum/binary-tree-maximum-path-sum.cpp): `124-binary-tree-maximum-path-sum/binary-tree-maximum-path-sum.cpp`
- [Linked List Cycle](https://github.com/5hraddhab/dsa/blob/main/141-linked-list-cycle/linked-list-cycle.cpp): `141-linked-list-cycle/linked-list-cycle.cpp`
- [List Intersection](https://github.com/5hraddhab/dsa/blob/main/160-intersection-of-two-linked-lists/intersection-of-two-linked-lists.cpp): `160-intersection-of-two-linked-lists/intersection-of-two-linked-lists.cpp`
- [Kth BST Value](https://github.com/5hraddhab/dsa/blob/main/230-kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst.cpp): `230-kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst.cpp`
- [Delete BST Node](https://github.com/5hraddhab/dsa/blob/main/450-delete-node-in-a-bst/delete-node-in-a-bst.cpp): `450-delete-node-in-a-bst/delete-node-in-a-bst.cpp`
- [Search BST](https://github.com/5hraddhab/dsa/blob/main/783-search-in-a-binary-search-tree/search-in-a-binary-search-tree.cpp): `783-search-in-a-binary-search-tree/search-in-a-binary-search-tree.cpp`
- [Insert BST](https://github.com/5hraddhab/dsa/blob/main/784-insert-into-a-binary-search-tree/insert-into-a-binary-search-tree.cpp): `784-insert-into-a-binary-search-tree/insert-into-a-binary-search-tree.cpp`
- [Validate BST](https://github.com/5hraddhab/dsa/blob/main/98-validate-binary-search-tree/validate-binary-search-tree.cpp): `98-validate-binary-search-tree/validate-binary-search-tree.cpp`

### Graph Algorithms

- [Breadth-First Search](https://github.com/5hraddhab/dsa/blob/main/GRAPH/BFS.cpp): `GRAPH/BFS.cpp`
- [Depth-First Search](https://github.com/5hraddhab/dsa/blob/main/GRAPH/DFS.cpp): `GRAPH/DFS.cpp`
- [Graph Creation](https://github.com/5hraddhab/dsa/blob/main/GRAPH/graphcreation.cpp): `GRAPH/graphcreation.cpp`

### Recursion

- [Permutations](https://github.com/5hraddhab/dsa/blob/main/46-permutations/permutations.cpp): `46-permutations/permutations.cpp`
- [Power Function](https://github.com/5hraddhab/dsa/blob/main/50-powx-n/powx-n.cpp): `50-powx-n/powx-n.cpp`
