Giter Club home page Giter Club logo

sahilbansal17 / competitive_coding Goto Github PK

View Code? Open in Web Editor NEW
407.0 10.0 308.0 1.32 MB

This repository contains some useful codes, techniques, algorithms and problem solutions helpful in Competitive Coding.

License: GNU General Public License v3.0

C++ 96.01% Shell 3.99%
competitive-programming competitive-programming-contests algorithms data-structures programming-contests algorithms-and-data-structures cpp algorithm hacktoberfest graph

competitive_coding's Introduction

Hello Fellow < Developers/ >!

Hi! My name is Sahil Bansal. Thank You for taking the time to view my GitHub Profile ๐Ÿ˜„

About Me

competitive_coding's People

Contributors

aashu24 avatar ananyajain721 avatar anujg935 avatar dhairyakhale avatar dinithiw avatar h-sinha avatar harshraj22 avatar heyayushh avatar ighosh98 avatar imkaka avatar jstjyoti avatar kruzzy avatar lavishsaluja avatar megha070 avatar mishra-tanay avatar monsij avatar navonildas avatar pritamnegi avatar ramitsawhney27 avatar sachindrck avatar sahilbansal17 avatar sam6134 avatar sandip75 avatar shivhek25 avatar siddhishree avatar sourabh1031 avatar tanviaanand avatar thealakazam avatar tomwia9 avatar udbhav-chugh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

competitive_coding's Issues

Islands in a Graph

Given:
A grid of size n x m. Each cell is either Red or Blue. Red is denoted as * and . as Blue.
The entire grid is surrounded in blue.
A collection of blue cells surrounded by red on all sides is considered a pool.

Tasks:

  1. Count the total number of pools in the grid.
  2. Return the size of each of the pools in the grid.
  3. Time and Space complexities for each of these operations.

Sample:
5 4

****
*..*
****
*.**
..**

Number of pools: 1; size = 2

Modified LCS Problem

Given:
n strings of length m consisting of only 'a' and 'b' as characters.
a hidden string of length m (this can be any string consisting of 'a' and 'b')

Tasks:

  1. Calculate the least value of the Longest Common Subsequence of the given n strings and the hidden string.

Sample:
2 given strings:
ab
ba

The hidden string can be (aa,ab,ba,bb). The LCS for all cases is equal to 1. Hence the answer is 1.

2 given strings:
aa
bb

The hidden string can be anything, the LCS will always be 0. Hence the answer is 0.

3 given strings:
aabb
abab
baab

Answer: 2

Breaking a number into primes

Given:
A positive integer n > 1.

Tasks:

  1. Print a list of primes such that their sum is equal to n, maximize the number of primes in this list.
  2. Add proper explanations and time complexity.

Samples:
2 - 2
4 - 2+2

Minimum Spanning Tree

Implement Minimum Spanning Tree algorithms:

  • Kruskal's algorithm [working: @Dhiraj240 ]
  • Prim's algorithm (Adjacency Matrix Implementation) [done: @tanvi15 ]
  • Prim's algorithm (Adjacency List Implementation)

Refer to Algorithms wiki page.

MergeSort In linkedList

In LinkedList data structure it becomes very difficult to sort it and further with a very good time complexity.MergeSort has good time complexity but for learners or students, it becomes very difficult to implement it in LinkedList. I will make 2-3 different functions to make students/learners understand different algorithms and finally use these functions in mergeSort.Therefore,
The following are the subtasks Of MergeSort are:-

  • Midpoint Of linked List Function (Without finding the length of LinkedList means fast operation)(@Anujg935 )
  • Merging 2 sorted LinkedList
  • MergeSort (Using above 2 functions )

Students Will get to know about many aspects on how too work on LinkedList by seeing this code.

Please assign this issue to me such that I can start working on it. If you have any suggestions to further improve it then please give.
Thanks.

Finding the GCD of 2 numbers

Greatest Common Divisor is one of the important algorithms in number theory it is used in many problems like prime numbers, cryptography etc.
I will make 2 algorithms for finding gcd of two numbers:-

  • Naive Algorithm (simplest approach) but very poor time complexity
  • Euclid's Algorithm (very fast approach)

please assign it to me so that I can start working on it as soon as possible.

Construction of Graphs

Basics of Graph Theory:
Construction of graphs via:

  1. Adjacency List
  2. Adjacency Matrix
  3. Edge List

Also, provide the complexity analysis for each of them.

Structure content

Structure the folders in 5 categories:

  1. Problem Solutions
  2. Algorithm Implementations
  3. Data Structures
  4. Tricks and Templates
  5. ACM-ICPC Notebook

Floyd-Warshall algorithm

As I have completed my previous task .can I work on Floyed Warshall Algorithm for finding all possible shortest path in a given graph?

Sorting algorithms.

  • Selection sort
  • Bubble Sort
  • Merge Sort
  • Counting sort
  • Heap Sort
  • Quick Sort
  • Radix Sort
  • Bucket Sort

Warmup Task - GSSoC

Hi all,

This is the warmup task for you to just solve a few problems and add your solutions right here.

We can follow a common website [Codeforces] to find problems for this task.

  • Go to the Problemset section of the site.
  • Find a tag(topic) of your interest (e.g. binary search) and click on it.
  • To sort the problems in increasing order of difficulty (can be estimated by the no of people who solved that problem), click on the last column heading which shows a โœ…. The numbers in that column denote the no of people who have solved the problem.
  • Solve atleast one problem in this topic and add your solutions here via a pull request mentioning the issue number(#13) in the description. The solutions are to be added in this folder.

For reference, check some solutions already in this repo on Graphs here, corresponding to which problems can be found here.

For any kind of discussions, either comment here or write in the Slack channel.

Pair sum problem in a Tree

Given a balanced binary search tree (take a sample tree in your code) and a number x, your task is to determine if there exists a pair of nodes, such that their sum is equal to x. Every node contains a value, left ptr and right ptr.

The following tasks need to be done for an entire score:

  1. Return the larger of the two numbers if there exists a pair, else -1 in time O(n).
  2. Space taken should be less than O(n).
  3. Explanations for all methods and time/space complexities.

Matrix Exponentiation for Fibonacci Series

Implementing a time-efficient algorithm to find the mod of the sum of the Fibonacci number ranging from the nth to the mth Fibonacci numbers using Matrix Exponentiation algorithm.

Trailing zeroes in N!

The program finds the number of trailing zeroes in the factorial of a given number.

Method of dynamic programming

Being of the most valuable tool for problem-solving, I would like to contribute a code base for many problems where they can be applied as referred to in Algorithms .

  • Traveling Salesman Problem
  • Longest Increasing Subsequence
  • Rod Cutting Problem
  • Coin change problem
  • Matrix Chain multiplication
  • Max 1D Range Sum
  • Max 2D Range Sum
  • Longest Common Subsequence
  • Longest Repeated Subsequence
  • Edit distance

Coin problem

Greedy Algorithm to find the minimum number of coins

Given a value V, if we want to make change for the amount V and we have infinite supply of each of the denominations in some currency say {1,2,5,10,20,50} (which will be taken as input from the user} valued coins/notes, what is the minimum number of coins and/or notes needed to make the change?

I will be implementing this algorithm in Java. Please assign it to me so that I can start working on it as soon as possible.

Subsequences of string questions

Given a string, the problem is to generate all possible subsequences of that given string. I will be coding this in Java. I will like to give the following three solutions to this problem :

  • Return all subsequences of the String (Recursive approach)

  • Longest repeated subsequence problem via top down DP

Please assign these three tasks to me so that I can start working on them as soon as possible.

Different LinkedList reversing Techniques

In LinkedList, many algorithms require to reverse the linked list.so it's the building block of many algorithms. I want to make 4 different methods of reversing the LinkedList some are recursive and some are iterative all have different complexity.
This helps students to learn about how to tackle the reversing problem of LinkedList.
Following are the different approaches:-
1. Recursive:-
- Simple recursion (Time Complexity O(n^2))
- Recursion Double Node (Time Complexity O(n)) this is to get to know students about the mix of data structures and oops concepts.
- Recursion Best Method (Time Complexity O(n))

2. Iterative:-
-This is for those who are not comfortable with recursion (Time Complexity O(n))

After learning these 4 approaches students gets the complete knowledge about Reversing the linked list.
I can also make the article or blog regarding this to make these approaches easy to understand.

Please assign me this issue so that i can start working on this. If there is any suggestion please give it to me.
Thanks.

Upsolving

Upsolve the problems for the various contests that have been given most recently.
The workflow should be in the following order:

  • Codeforces C problems of the Div 2 contests
  • All the problems in the Educational Rounds of Codeforces
  • Complete problemset of the Hackerrank contests
  • Easy-Medium level problems of the Topcoder contests
  • Codechef Long Contests
  • Codechef Lunchtime and Cook-offs
  • CS Academy Rounds
  • HackerEarth Contests
  • Codeforces D and E Problems of the Div 2 contests

Recursion Problems

Hey, i want to add some recursion problems and their solutions ,can you assign me that task ?

2-4 trees Implementation

Implementation of basic operations and construction of the 2-4 tree.

  • Insertion
  • Deletion
  • Search

Sliding window algorithm

I would like to work on the sliding window algorithm.
I'll be taking up the problem of calculating the max consecutive sum in an array such that it is less than or equal to an entered number.

Add Divide & Conquer algorithms

Implement the following algorithms [take reference from MIT OCW 6-046 Spring 2015 Lectures] :

  • Weighted Job Scheduling [Lecture 1]
  • Closest Pair of Points [Related to Problem Set 1]
  • Convex Hull [Lecture 2]
  • Median Finding [Lecture 2]
  • Strassen's Algorithm for Matrix multiplication [Recitation]

Each of them will be treated as a separate issue.
As you finish either of them, tick it above and send a PR mentioning this issue number.

Tower Of Hanoi Problem

In recursion Tower of Hanoi problem is very much important and gives the students a very good knowledge about how actually the recursion works.
Please assign it to me.

STL implementations

  • Explaining the most common operations for STL implementations of each of the following data structures along with the time complexities involved for the operations, write well commented code following the standards.
  • Take inputs from user wherever required via good prompts.

Make changes in the appropriate linked files.

Each of the 5 are separate issues with the category cakewalk and can be taken up only by different people. The first one to claim below a specific sub-task will be assigned for it.

Edit distance problem

Given two strings, we have to find the minimum number of operations (edits) that can be performed on the strings to make them both equal. The following operations can be performed on the strings:

  1. Inserting a character
  2. Removing a character
  3. Replacing a character with some other character

I would like to work on this problem in Java. Please assign it to me.

Binary Search Tree

  • Insertion, Deletion, Traversal, Search
  • LCA Construction
  • Height related operations

Disjoint Set Union

  • Basic operations and complexity analysis [working : @mohitj27 ]
  • Use in Graphs and related problems
  • Path compression and Union by rank
  • Complexity analysis (Advanced)

Add Graph algorithms

Implement the following Elementary Graph Algorithms taking reference from the Chapter 22 of the book Introduction to Algorithms

  • Breadth-first search
  • Depth-first search
  • Topological sort

Modified Fibonacci Sequence

Defining the modified Fibonacci sequence as:

F(n) = F(n-1) + 2F(n-2) + 3F(n-3)
where, F(0) = 0, F(1) = 1, F(2) = 3

The following tasks have to complete for an entire score:

  1. Write a function to return the nth modified Fibonacci number in less than O(n) time.
  2. Write a function to print the first n modified Fibonacci numbers in O(n) time.
  3. Clearly explain your solution, with proofs for how you arrived at the time complexities.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.