https://github.com/tonystark-19/cpp-coding
This repo contains c++ program made by me : )
https://github.com/tonystark-19/cpp-coding
cpp cppprogramming
Last synced: 2 months ago
JSON representation
This repo contains c++ program made by me : )
- Host: GitHub
- URL: https://github.com/tonystark-19/cpp-coding
- Owner: TonyStark-19
- Created: 2024-11-16T06:56:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-19T16:17:07.000Z (11 months ago)
- Last Synced: 2025-01-19T17:27:45.182Z (11 months ago)
- Topics: cpp, cppprogramming
- Language: C++
- Homepage:
- Size: 1.13 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π C++ OOP and DSA Programs Repository
This repository contains a collection of **C++ programs** covering **Object-Oriented Programming (OOP)** concepts and **Data Structures & Algorithms (DSA)**. Each program demonstrates specific principles, helping you build a strong foundation in **C++ programming**. Itβs designed to help you master C++ through hands-on coding.
---
## π Repository Structure
This repository is organized into multiple folders, each containing various programs related to **OOP** and **DSA**.
### π Object-Oriented Programming (OOP) Concepts
#### πΉ [Class-Programs](./Class-Programs/)
Programs demonstrating **class structure, object creation, templates and much more**.
- [ ] **Class program** - simple class program
- [ ] **Destructor** - destructor program
- [ ] **Parametrized constructor** - a type of constructor
- [ ] **Shallow vs Deep copy** - to understand how shallow and deep copy works
- [ ] **Static data member** - to understand usage of static data member
- [ ] **Student marksheet** - student marksheet program using class
- [ ] **Templates** - to understand usage of templates in c++
#### πΉ [Functions](./Functions/)
Programs related to **Static member, friend, and inline functions**.
- [ ] **Friend function** - to understand usage of friend function
- [ ] **Inline function** - to understand usage of inline function
- [ ] **Static member function** - to understand usage of static memeber function
#### πΉ [Inheritance](./Inheritence/)
Covers **single, multilevel, multiple, hierarchical and hybrid inheritance**.
- [ ] **Hierarchical inheritance** - to understand hierarchical inheritance
- [ ] **Hybrid Inheritance** - to understand hybrid Inheritance
- [ ] **Multilevel inheritance** - to understand multilevel inheritance
- [ ] **Multilevel inheritance 2** - another program using multilevel inheritance
- [ ] **Multiple inheritance** - to understand multiple inheritance
- [ ] **Single inheritance** - to understand single inheritance
#### πΉ [Polymorphism](./Polymorphism/)
Examples of **function overloading, operator overloading, and runtime polymorphism**.
- [ ] **Function overriding** - to understand the concept of function overriding
- [ ] **Operator overloading** - Binary Minus (-) Operator
- [ ] **Operator overloading** - Binary Plus (+) Operator
- [ ] **Operator overloading** - Equality (==) Operator
- [ ] **Operator overloading** - Increment (++) Operator
- [ ] **Runtime polymorphism** - to understand usage of virtual functions
---
### π Data Structures & Algorithms (DSA)
#### πΉ [Array Data Structure](./Array%20data%20structure/)
Implementation of arrays and **solutions to various LeetCode problems with different approaches**.
- [ ] **2Sum** - leetcode 1
- [ ] **3Sum** - leetcode 15 (using hashing)
- [ ] **3Sum 2** - leetcode 15 (using two pointer approach)
- [ ] **4Sum** - leetcode 18
- [ ] **Aggresive cows** - using binary search approach
- [ ] **Binary search** - using iterative method
- [ ] **Binary search 2** - using recursive method
- [ ] **Binary search 3** - leetcode 33
- [ ] **Book allocation** - using binary search approach
- [ ] **Bubble sort** - bubble sort algorithm
- [ ] **Buy and sell** - leetcode 121
- [ ] **Container with most water** - leetcode 21 (brute force)
- [ ] **Container with most water 2** - leetcode 21 (using two pointer approach)
- [ ] **Diagonal sum in matrix** - leetcode 1572
- [ ] **Find duplicate** - leetcode 287
- [ ] **Find missing and repeating value** - leetcode 2965
- [ ] **Insertion sort** - insertion sort algorithm
- [ ] **Linear search** - linear search algorithm
- [ ] **Linear search in matrix** - linear search in matrix
- [ ] **Majority element** - leetcode 169 (brute force)
- [ ] **Majority element 2** - leetcode 169 (moore's voting algorithm)
- [ ] **Maximum row and column sum** - Maximum row and column sum problem
- [ ] **Maximum subarray sum** - leetcode 53 (brute force)
- [ ] **Maximum subarray sum 2** - leetcode 53 (Kadane's algorithm)
- [ ] **Merge sorted arrays** - leetcode 88
- [ ] **Next permutation** - leetcode 31
- [ ] **Painter's partition** - using binary search approach
- [ ] **Pair sum** - binary search approach
- [ ] **Pair sum 2** - two pointer approach
- [ ] **Peak index** - leetcode 852 (brute force)
- [ ] **Peak index 2** - leetcode 852 (optimized)
- [ ] **Power function** - leetcode 50
- [ ] **Product of array** - leetcode 238 (brute force)
- [ ] **Product of array 2** - leetcode 238 (optimized)
- [ ] **Reverse array** - to reverse an array
- [ ] **Search in 2d matrix** - leetcode 74
- [ ] **Search in 2d matrix II** - leetcode 240
- [ ] **Selection sort** - selection sort algorithm
- [ ] **Single element** - leetcode 540 (brute force)
- [ ] **Single element 2** - leetcode 540 (binary search)
- [ ] **Small and large in array** - Small and large element in array
- [ ] **Sort colors** - leetcode 75 (optimized)
- [ ] **Sort colors** - leetcode 75 (Dutch national flag algortihm)
- [ ] **Spiral matrix** - leetcode 54
- [ ] **Subarray sum equal k** - leetcode 560
- [ ] **Sum product in array** - sum and product of an array
- [ ] **Swap max min in array** - to swap max and min elements of an array
#### πΉ [Linked-List](./Linked-list/)
Implementation of Linked list and **solutions to various LeetCode problems with different approaches**.
- [ ] **Circular Linked-list** - program for circular linked list implementation
- [ ] **Copy list with random pointers** - leetcode 138
- [ ] **Doubly Linked-list** - program for doubly linked list implementation
- [ ] **Flatten a Multilevel Doubly Linked List** - leetcode 430
- [ ] **Linked-list intro** - program for linked list implementation
- [ ] **Linked-list cycle** - leetcode 141
- [ ] **Linked-list cycle II** - leetcode 142
- [ ] **LRU Cache** - leetcode 146
- [ ] **Merge two sorted lists** - leetcode 21
- [ ] **Middle of Linked-list** - leetcode 876
- [ ] **Reverse Linked-list** - leetcode 206
- [ ] **Reverse nodes in k group** - leetcode 25
- [ ] **Swap Nodes in Pairs** - leetcode 24
#### πΉ [Stack](./Stack/)
Implementation of Stack and **solutions to various LeetCode problems with different approaches**.
- [ ] **Celebrity Problem** - the celebrity problem
- [ ] **Design Min Stack** - leetcode 155
- [ ] **Design Min Stack 2** - leetcode 155 (more optimal)
- [ ] **Largest Rectangle in Histogram** - leetcode 84
- [ ] **Next greater element** - next greater element problem
- [ ] **Next greater element I** - leetcode 496
- [ ] **Next greater element II** - leetcode 503
- [ ] **Previous Smaller Element** - previous smaller element problem
- [ ] **Stack using Linked-list** - stack implementation using linked-list
- [ ] **Stack using STL** - stack implementation using STL library
- [ ] **Stack using vectors** - stack implementation using vectors
- [ ] **Stock span** - stock span problem
- [ ] **Trapping Rain Water** - leetcode 42 (using prefix array)
- [ ] **Trapping Rain Water 2** - leetcode 42 (using two pointer approach)
- [ ] **Valid Parentheses** - leetcode 20
#### πΉ [Queue](./Queue/)
Implementation of Queue and **solutions to various LeetCode problems with different approaches**.
- [ ] **Circular queue** - circular queue implementation using array
- [ ] **Deque** - Double ended queue implementation using STL
- [ ] **Gas station** - leetcode 134
- [ ] **Queue intro** - queue implementation using linked-list
- [ ] **Queue intro 2** - queue implementation using STL
- [ ] **Queue using stack** - leetcode 232
- [ ] **Sliding Window Maximum** - leetcode 239
- [ ] **Stack using queue** - leetcode 225
- [ ] **Unique char** - leetcode 387
#### πΉ [Tree](./Tree/)
Implementation of Tree and **solutions to various LeetCode problems with different approaches**.
- [ ] **Binary search tree** - implement binary search tree
- [ ] **Binary tree** - building binary tree and implementing different tree traversals.
- [ ] **Binary tree path** - leetcode 257
- [ ] **Bottom view of binary tree** - to find the tree nodes which are visible from bottom
- [ ] **BST from preorder sequence** - leetcode 1008
- [ ] **BST Iterator** - leetcode 173
- [ ] **Build tree** - leetcode 105
- [ ] **Count nodes** - to count number of nodes in a tree
- [ ] **Delete node in BST** - delete node in binary search tree
- [ ] **Diameter of Binary Tree** - leetcode 543
- [ ] **Diameter of Binary Tree 2** - leetcode 543 (more optimal)
- [ ] **Flatten binary tree to linkedlist** - leetcode 114
- [ ] **Height of tree** - to calculate height of tree
- [ ] **Identical tree** - leetcode 100
- [ ] **InorderPreAndSucc** - Inorder Predecessor & Successor in BST
- [ ] **Kth level of tree** - to print nodes of kth level of tree
- [ ] **kth smallest in BST** - leetcode 230
- [ ] **Largest BST in binary tree** - to find largest BST in binary tree
- [ ] **Lowest common ancestor in binary tree** - leetcode 236
- [ ] **Lowest common ancestor in BST** - leetcode 235
- [ ] **Maximum width of binary tree** - leetcode 662
- [ ] **Merge two BST** - merge two binary search tree
- [ ] **Minimun distance between BST nodes** - leetcode 783
- [ ] **Morris inorder traversal** - leetcode 94
- [ ] **Populate next right pointers** - leetcode 116
- [ ] **Recover BST** - leetcode 99
- [ ] **Search in BST** - search in binary search tree
- [ ] **Sorted array to balanced BST** - leetcode 108
- [ ] **Subtree or not** - leetcode 572
- [ ] **Sum of nodes** - to calulate sum of nodes value of tree
- [ ] **Top view of binary tree** - to find the tree nodes which are visible from top
- [ ] **Transform to sum tree** - transform binary tree to sum tree
- [ ] **Validate binary search tree** - leetcode 98
#### πΉ [Recursion](./Recursion/)
Programs demonstrating **recursive problem-solving techniques**.
- [ ] **Binary search** - leetcode 704
- [ ] **Combination Sum** - leetcode 39
- [ ] **Count inversion** - using merge sort algorithm
- [ ] **Factorial** - factorial using recursion
- [ ] **Fibonacci** - leetcode 509
- [ ] **Is array sorted** - is array sorted or not using recursion
- [ ] **Knights tour** - leetcode 2596
- [ ] **Merge sort algorithm** - merge sort algorithm implementation using recursion
- [ ] **N queens** - leetcode 51
- [ ] **N sum** - sum of n values using recursion
- [ ] **Palindrome partitioning** - leetcode 131
- [ ] **Permutations in array** - leetcode 46
- [ ] **Quick sort algorithm** - quick sort algorithm implementation
- [ ] **Rat in a maze** - rat in a maze problem using recursion
- [ ] **Subsets** - leetcode 78
- [ ] **Subsets II** - leetcode 90
- [ ] **Sudoku solver** - leetcode 37
#### πΉ [Patterns](./Patterns/)
A collection of **pattern-printing programs using loops**.
- [ ] **Butterfly pattern**
- [ ] **Floyd triangle pattern**
- [ ] **Hollow diamond pattern**
- [ ] **Inverted triangle pattern**
- [ ] **Pyramid pattern**
- [ ] **Reverse triangle pattern**
- [ ] **Square pattern**
- [ ] **Square pattern 2**
- [ ] **Triangle pattern**
- [ ] **Triangle pattern 2**
---
### π Additional Sections
#### πΉ [Cpp Programs](./Cpp%20programs/)
General **C++ programs** that don't fit into the above categories.
- [ ] **Count primes** - to count all prime numbers in a range
- [ ] **GCD** - gcd program using Euclid's Algorithm
- [ ] **Palindrome number** - leetcode 9
- [ ] **Permutation in a string** - leetcode 567
- [ ] **Read and Write in a file** - to read and write in file using file handling
- [ ] **Remove all occurrences** - leetcode 1910
- [ ] **Reverse integer** - leetcode 7
- [ ] **Reverse string** - leetcode 344
- [ ] **Reverse string 2** - to reverse a string directly using reverse function
- [ ] **Reverse words in a string** - leetcode 151
- [ ] **String compression** - leetcode 443
- [ ] **Valid palindrome** - leetcode 125
---
## π§ Prerequisites
To run the programs in this repository, you need:
- A C++ compiler (e.g., GCC, MinGW, or Visual Studio).
- Basic knowledge of C++ programming, OOP principles, and DSA techniques.
---