-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the competitive programming wiki! Below is the list of programs to get a hands on for competitive programming.
👍 For all the theoretical stuff do checkout my posts on Medium.
- Data Structure : https://medium.com/@therahulgoel/csenotes-1-data-structures-27b9672d5c3a
- Algorithms : https://medium.com/@therahulgoel/csenotes-3-algorithms-33f966c975c9
1. Basic link
- Print Hello world
- Count Number of digits in given number n
2. Mathematical
- GCD of two given numbers a and b
- LCM of two given numbers a and b
- HCF of two given numbers a and b
- Check given number is prime or not
- Fibonacci Series up to n terms
- Factorial of given number n
- Sum of n natural numbers
3. String
-
Number of characters in given string
-
Reverse of given string
-
Reverse of given sentence
-
Occurence/Frequency of every distinct character in given string
-
Return maximum occurring character in given string
-
To print all permutations of given string
-
Paranenthesis chacker : for given expression check if given expression is in correct order of { } ( ) [] Print Balanced if yes or print not Balanced
-
Reverse words of given sentence
-
Remove all adjacent duplicates from given string with recursion
-
Longest common subsequence in given String
-
Longest common Substring in given string
-
Remove all the duplicates from given string With order of characters same as original order.
4. Pattern Printing
- Print the pattern For input i.e. n :4

- Print the pattern For input i.e. n :4

- Print the pattern For input i.e. n :4

- Print the pattern For input i.e. n :4

- Print the pattern For input i.e. n :4

- Print the pattern For input i.e. n :5

- Print the pattern For input i.e. n :5

- Print the pattern For input i.e. n :5

...
5. Recursion
-
Sum of numbers from given list of elements of size N using recursion
-
Sum of first N natural numbers using recursion
-
Count Number of characters in given string using recursion
-
Reverse of given string using recusion
-
Power p of given number n Pow(n,p)
-
Factorial of given number n
-
Nth Fibonacci Term from fibonacci series
-
Return all the words from a given sentence
...
6. Arrays link
-
To Left - Rotate given array of size n by d elements With Different methods - O(n) Time
-
To cyclically Right- Rotate given array arr by one-element with size n - O(n) Time
-
Search an element d in a sorted and rotated array arr with size n - O(log(n)) Time
-
To print all elements in given array - Time - O(n)
-
Equilibrium point : In given array arr find position on which sum of all the left elements are equal to all the right elements if exists, if not return -1 Time - O(n)
-
Missing number in given array - consider array contain elements from 1 t0 n-1 except one number missing Time - O(n)
-
Kadane's algorithm : For given array arr (with +ve and -ve values) find contiguous sub-array with max sum.
-
Find contiguous sub array which adds to given number. (Array contains only positive numbers)
-
Find contiguous sub array which adds to given number. (Array may contain negative numbers as well)
-
Program to sort the given array with only 0,1,2 in ascending order. Or (Dutch National Flag Problem)
-
Leaders in Array : an element is leader if it is greater than all elements to its right side. Rightmost element in array is always leader. Time O(n)
-
Find kth smallest element in given array of size n where k<n and all elements are distinct.
-
Find element that appears once in array, in which every other element appear thrice. Time - O(n)
-
For an array in which every other element appear twice, find element that appears once. - Time O(n)
7. Stack
- Push or insert element in Stack - O(1) Time
- Pop or delete any element from stack - O(1) Time
- Count number of elements in stack - O(1) Time
8. Queue
...
9. Binary Tree
- Test Binary creation with seven nodes in it
- Depth First Traversal (PreOrder, InOrder, PostOrder) - O(n) Time
- Breadth First Traversal Or Level Order Traversal - O(n) Time
- Calculate of height of given Binary tree - O(n) Time
- Count Number of leaf nodes in given Binary tree - O(n) Time
- Count Number of Non-Leaf or internal Nodes in given tree - O(n) Time
10. Searching
- Linear Search "To search an element e in given array arr of size n" - O(n) Time
- Binary Search - O(log(n)) Time
11. Sorting
- Bubble Or Sinking Sort - O(n^n) Time
- Heap Sort - O(n^log(n)) Time
- Selection Sort - O(n^n) Time
- Insertion Sort - O(n^n) Time
- Quick Sort - O(n^n) Time
- Merge Sort
- Counting Sort
- Radix Sort
12. Binary Search Tree
...
13. Graph
...
14. Heap
...
15. Matrix
-
Read and print m*n matrix where m = number of rows, n = number of columns
-
Multiplication and sum of two matrix A and B
-
Print Diagonals of given input matrix of size m*n
-
Transpose of given matrix of size m*n
...
16. Bit Manipulation
...