Skip to content
Rahul Goel edited this page Nov 1, 2017 · 19 revisions

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.

  1. Data Structure : https://medium.com/@therahulgoel/csenotes-1-data-structures-27b9672d5c3a
  2. Algorithms : https://medium.com/@therahulgoel/csenotes-3-algorithms-33f966c975c9

1. Basic link

  1. Print Hello world
  2. Count Number of digits in given number n

2. Mathematical

  1. GCD of two given numbers a and b
  2. LCM of two given numbers a and b
  3. HCF of two given numbers a and b
  4. Check given number is prime or not
  5. Fibonacci Series up to n terms
  6. Factorial of given number n
  7. Sum of n natural numbers

3. String

  1. Number of characters in given string

  2. Reverse of given string

  3. Reverse of given sentence

  4. Occurence/Frequency of every distinct character in given string

  5. Return maximum occurring character in given string

  6. To print all permutations of given string

  7. Paranenthesis chacker : for given expression check if given expression is in correct order of { } ( ) [] Print Balanced if yes or print not Balanced

  8. Reverse words of given sentence

  9. Remove all adjacent duplicates from given string with recursion

  10. Longest common subsequence in given String

  11. Longest common Substring in given string

  12. Remove all the duplicates from given string With order of characters same as original order.

4. Pattern Printing

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

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

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

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

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

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

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

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

...

5. Recursion

  1. Sum of numbers from given list of elements of size N using recursion

  2. Sum of first N natural numbers using recursion

  3. Count Number of characters in given string using recursion

  4. Reverse of given string using recusion

  5. Power p of given number n Pow(n,p)

  6. Factorial of given number n

  7. Nth Fibonacci Term from fibonacci series

  8. Return all the words from a given sentence

...

6. Arrays link

  1. To Left - Rotate given array of size n by d elements With Different methods - O(n) Time

  2. To cyclically Right- Rotate given array arr by one-element with size n - O(n) Time

  3. Search an element d in a sorted and rotated array arr with size n - O(log(n)) Time

  4. To print all elements in given array - Time - O(n)

  5. 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)

  6. Missing number in given array - consider array contain elements from 1 t0 n-1 except one number missing Time - O(n)

  7. Kadane's algorithm : For given array arr (with +ve and -ve values) find contiguous sub-array with max sum.

  8. Find contiguous sub array which adds to given number. (Array contains only positive numbers)

  9. Find contiguous sub array which adds to given number. (Array may contain negative numbers as well)

  10. Program to sort the given array with only 0,1,2 in ascending order. Or (Dutch National Flag Problem)

  11. 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)

  12. Find kth smallest element in given array of size n where k<n and all elements are distinct.

  13. Find element that appears once in array, in which every other element appear thrice. Time - O(n)

  14. For an array in which every other element appear twice, find element that appears once. - Time O(n)

7. Stack

  1. Push or insert element in Stack - O(1) Time
  2. Pop or delete any element from stack - O(1) Time
  3. Count number of elements in stack - O(1) Time

8. Queue

...

9. Binary Tree

  1. Test Binary creation with seven nodes in it
  2. Depth First Traversal (PreOrder, InOrder, PostOrder) - O(n) Time
  3. Breadth First Traversal Or Level Order Traversal - O(n) Time
  4. Calculate of height of given Binary tree - O(n) Time
  5. Count Number of leaf nodes in given Binary tree - O(n) Time
  6. Count Number of Non-Leaf or internal Nodes in given tree - O(n) Time

10. Searching

  1. Linear Search "To search an element e in given array arr of size n" - O(n) Time
  2. Binary Search - O(log(n)) Time

11. Sorting

  1. Bubble Or Sinking Sort - O(n^n) Time
  2. Heap Sort - O(n^log(n)) Time
  3. Selection Sort - O(n^n) Time
  4. Insertion Sort - O(n^n) Time
  5. Quick Sort - O(n^n) Time
  6. Merge Sort
  7. Counting Sort
  8. Radix Sort

12. Binary Search Tree

...

13. Graph

...

14. Heap

...

15. Matrix

  1. Read and print m*n matrix where m = number of rows, n = number of columns

  2. Multiplication and sum of two matrix A and B

  3. Print Diagonals of given input matrix of size m*n

  4. Transpose of given matrix of size m*n

...

16. Bit Manipulation

...

Clone this wiki locally