Skip to content

Instantly share code, notes, and snippets.

View syedsouban's full-sized avatar

Syed Souban syedsouban

  • Hyderabad
View GitHub Profile
@syedsouban
syedsouban / EfficientSubset.cpp
Last active March 14, 2022 22:19
Using bitmasking to store Subsets efficiently
//this technique provides a way to efficiently store subsets of a set of natural numbers upto N.
//When N should be the number of bits any type can store
//for example a 32-bit integer will be able to store subsets for a set of natural numbers upto N
//Reference: https://www.youtube.com/watch?v=685x-rzOIlY&list=PLb3g_Z8nEv1icFNrtZqByO1CrWVHLlO5g&index=3
//One thing to note is that this piece of code handles the edge cases of trying to add an element which already exists
// or trying to remove an element which does not exist
#include<iostream>
using namespace std;
class Subset {
1. Download Anaconda (https://repo.anaconda.com/archive/Anaconda3-2020.11-Windows-x86_64.exe)
2. Open anaconda prompt
3. Run the following commands in anaconda prompt
1. conda create -n venv python=3.7.4 anaconda
2. conda config --append channels conda-forge
3. conda install --yes --file requirements.txt
4. conda install -c conda-forge opencv=3.4.1
5. pip install imutils
(check if above package is installed or not using conda list)
6. python main.py
Board.find({})
.populate({
path: 'pins',
model: 'Pin'
})
.exec(function(err,boards){
var dates=[];
boards.forEach(function(board){
dates=[];
board.pins.forEach(function(pin){
#include<stdio.h>
void swap(int* x,int* y)
{
int t;
t=*x;
*x=*y;
*y=t;
}
int partition(int* a,int start,int end)
{