This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
#define ll long long | |
ll large=1000000007; | |
bool distinct(ll i,ll k) | |
{ | |
set<ll>s; | |
while(i>0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 1. Randomly generate any code of four digit no with | |
unit as a fibboniccai no & prime no | |
tenth & hundred place difference as 2 | |
hundred & thousand place difference as 2 | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
int arr[]={2,3,5}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 2. Randomly generate all code of four digit no with | |
unit as a fibboniccai no & prime no | |
tenth & hundred place difference as 2 | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
int arr[]={2,3,5}; | |
void code_gen(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int t; | |
cin>>t; | |
while(t--){ | |
int a[3],c[3]; | |
// input | |
for(int i=0;i<3;i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
set<vector<string>>s; | |
void distinct(string arr[],int n){ | |
vector<string>v; | |
for(int i=0;i<n;i++){ | |
v.push_back(arr[i]); | |
} | |
s.insert(v); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AVL Implemented | |
#include<bits/stdc++.h> | |
using namespace std; | |
struct Node | |
{ | |
int data, height; | |
Node *left, *right; | |
Node(int x) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
struct node{ | |
int data; | |
node *next; | |
node(int d) | |
{ | |
data=d; | |
next=NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
void max_heapify(vector<int>&arr,int i,int N){ | |
if(i==0 || N==0){ | |
return; | |
} | |
int largest,left=2*i,right=2*i+1; | |
if(left<=N && arr[left]>=arr[i]){ | |
largest=left; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Undirected & non weighted GRAPH | |
// O(n+m) time complexity | |
// vertices start from 1 onwards | |
#include <bits/stdc++.h> | |
using namespace std; | |
class Graph{ | |
int vertices; | |
vector<int>*adj; | |
bool *visited; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DIJKSTRA on weighted GRAPH | |
// O(n+mlog(m)) time complexity | |
// vertices start from 1 onwards | |
// can't work in case of negative edges | |
#include <bits/stdc++.h> | |
using namespace std; | |
const int INF=1e7; | |
class Graph{ | |
int vertices; |
OlderNewer