Skip to content

Instantly share code, notes, and snippets.

Aditya Soni adist98

  • India
Block or report user

Report or block adist98

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cycle_undirected.cpp
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;
const int mx=1e4+1;
vector<int>v[mx];
int cont=0;
View 369.cpp
// coder : adist98
// Given two long long integers a and b. The task is to prlong long int
// sum of all the digits appearing in the
// long long integers between a and b
#include "bits/stdc++.h"
using namespace std;
// Memoization for the state results
long long int dp[52][50][50][50][2];
View DigitDP.cpp
// DigitDP variation for calculating the sum of digits - CPCRC1C on SPOJ
// Code inspired by GeeksforGeeks - coded by adist98
// Given two integers a and b. The task is to print
// sum of all the digits appearing in the
// integers between a and b
#include "bits/stdc++.h"
using namespace std;
// Memoization for the state results
long long int dp[20][180][2];
View RSumQLazyPropSegTree.cpp
// coder : adist98
// dynamic RangeSumQuery using segment trees and lazy propagation//
#include<bits/stdc++.h>
using namespace std;
void updateSegTreelazy(long long int segTree[], long long int lazy[], long long int startRange, long long int endRange, long long int delta, long long int low, long long int high, long long int pos){
if(low > high){
return;
View RangeSumQuery_SegmentTree.cpp
// static RangeSumQuery using segment trees //
#include<bits/stdc++.h>
using namespace std;
void ConstructTree(long long int input[], long long int segTree[],long long int low,long long int high,long long int pos){
if(low == high){
segTree[pos] = input[low];
return;
}
@adist98
adist98 / flib-matex.cpp
Created Jun 18, 2019
The most beautiful, clean and concise matrix exponentiation i have seen till now. SPOJ - FLIB
View flib-matex.cpp
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
View Matrix_exponentiation.cpp
// general implementation of matrix exponentiation .. ..
#include<bits/stdc++.h>
using namespace std;
int main()
{
unsigned long long int w;
cin >> w;
unsigned long long int a[w][w] = {{0}};
View fib_efficient.cpp
#include <stdio.h>
void multiply(int F[2][2], int M[2][2]); // function to multiply two 2x2 matrices
void power(int F[2][2], int n); // function to calculate the power
/* function that returns nth Fibonacci number */
int fib(int n)
{
int F[2][2] = {{1,1},{1,0}};
View power.cpp
/* Function to calculate x raised to the power y in O(logn)*/
int power(int x, unsigned int y)
{
int temp;
if( y == 0)
return 1;
temp = power(x, y/2);
if (y%2 == 0)
return temp*temp;
else
View Code.cpp
// Singly Linked List implementation in c++
#include <iostream>
using namespace std;
struct node
{
int data;
node *next;
You can’t perform that action at this time.