Sayef Azad Sakin


Blog Posts
  • Sample blog post to learn markdown tips

    There's lots to learn!

    By Bill Smith
    This is a demo post to show you how to write blog posts with markdown. I strongly encourage you to take 5 minutes to learn how to write in markdown - it’ll teach you how to transform regular text into bold/italics/tables/etc.I also encourage you to look at the code that... [Read More]
    Tags:
  • Setup Virtual Router (Windows)

    By Sayef Azad Sakin
    Set the network details: netsh wlan set <network_name> mode=allow ssid=<ssid> key=<password> netsh wlan start <network_name> Example: netsh wlan set hostednetwork mode=allow ssid=ss key=ssssss netsh wlan start hostednetwork To stop the Wireless Hosted Network: netsh wlan stop <network_name> To see the Wireless Hosted Network details, including the MAC addresses of connected... [Read More]
  • Quantum Computing Resources

    By Sayef Azad Sakin
    Wired link: http://www.wired.com/wiredenterprise/2013/06/d-wave-quantum-computer-usc/ blog post: http://googleresearch.blogspot.com/2013/05/launching-quantum-artificial.html John Preskill: Quantum Computing and the Entanglement Frontier https://www.youtube.com/watch?v=8-IqQnGYB2M Googles explanation about quantum computing https://www.youtube.com/watch?v=CMdHDHEuOUE official google+ page: https://plus.google.com/+QuantumAILab/posts Microscopic and macroscopic systems It is useful, at this stage, to make a distinction between the different sizes of the systems that we are going... [Read More]
  • Restore boot manager after installing windows 7 over linux

    By Sayef Azad Sakin
    Boot from the ubuntu Live CD. Open the terminal from applications -> Accessories -> Terminal. Then find the partition of your Ubuntu OS from the list generated with the command, sudo fdisk -l  If your ubuntu(linux) partion is sda6, sudo mkdir /media/sda6 sudo mount /dev/sda6 /media/sda6 After that you have... [Read More]
    Tags:
  • Some secret code of Mobile

    By Sayef Azad Sakin
    *#92702689# -> Warranty settings. *#7760# -> Production serial no. *#bta0# -> MAC address of bluetooth. *#9999# -> Firmware version. *#2640# -> Security code. *#7328748263373738# -> Default security code. *#43# -> Call waiting status. *#2820# -> Bluetooth info. *#7370# -> Format mobile memory. *#delset# -> reset GPRS & E-mail Setting. [Read More]
    Tags:
  • Lowest Common Ancestor

    By Sayef Azad Sakin
    //<O(N logN, O(logN)> #define mx 10010 #define logmx ceil(log(mx)) #define pii pair < int, int > //#define i64 __int64 #define inf 2147483647 [Read More]
    Tags:
  • Binary Indexed Tree

    By Sayef Azad Sakin
    #define i64 long long i64 BIT[mx]; int n; //1-D BIT i64 read(int idx){ i64 sum = 0; while (idx > 0){ sum += BIT[idx]; idx -= (idx & -idx); } return sum; } [Read More]
    Tags:
  • Character Device Driver (for linux)

    By Sayef Azad Sakin
    Little talk..... This was my 3rd assignment in System programming lab(3rd year undergrad course). The main task of this assignment is to design a character driver which should exist in linux kernel. I make a kernel module which module implements a driver that exposes two character devices to user-space. Lets... [Read More]
  • ls (my own implementation)

    By Sayef Azad Sakin
    Little talk about 'ls' (since I have very small knowledge about it): ls - list directory contents. The 'ls' program lists information about files (of any type, including directories). Options and file arguments can be intermixed arbitrarily, as usual. Know details about 'ls' in linux man page: http://unixhelp.ed.ac.uk/CGI/man-cgi?ls Little talk about coding: Probably... [Read More]
  • MAKEFILE (at a glance)

    By Sayef Azad Sakin
    Sample code project1: data.o main.o io.o         cc data.o main.o io.o -o project1 data.o: data.c data.h         cc -c data.c main.o: data.h io.h main.c         cc -c main.c io.o: io.h io.c         cc -c io.c #this is a... [Read More]
  • Windows 7 Command Prompt Commands

    By Sayef Azad Sakin
    Append: It can be used by programs to open files in another directory as if they were located in the current directory. Arp: It is used to display or change entries in the ARP cache.. Assoc: The assoc command is used to display or change the file type associated with... [Read More]
    Tags:
  • Linux tutorials

    By Sayef Azad Sakin
    Linux Mint How To Restore Grub After Windows 7 Repair Install
    Tags:
  • Strongly Connected Component (Tarjan)

    By Sayef Azad Sakin
    vector< int > M[MX]; int color[MX],f[MX],low[MX],ftm,st[MX],top,scc; bool instack[MX]; void dfs(int u){ int i,v,sz; f[u] = ftm; low[u] = ftm; ftm++; st[top] = u;top++;instack[u] = true; sz = M[u].size(); color[u] = 1; for(i=0;i<sz;i++){ v = M[u][i]; if(!color[v]){ dfs(v); low[u] = _min(low[u],low[v]); } else if(instack[v])low[u] = _min(low[u],f[v]); } if(f[u] == low[u]){ scc++;... [Read More]
    Tags:
  • Maximum Flow (basic)

    By Sayef Azad Sakin
    vector < int > M[mx]; int pre[mx], cap[mx][mx]; bool color[mx]; int bfs(int s, int t){ int ok,u,v,sz,i,path_cap; memset(pre,-1,sizeof(pre)); memset(color,0,sizeof(color)); queue < int > q; color[s] = 1; q.push(s); ok = 1; while(!q.empty() && ok){ u = q.front(); q.pop(); sz = M[u].size(); for(i=0;i<sz;i++){ v = M[u][i]; if(!color[v] && cap[u][v] > 0){... [Read More]
    Tags:
  • Max flow with min cut

    By Sayef Azad Sakin
    vector < int > M[mx]; i64 cap[mx][mx], CAP[mx][mx]; int pre[mx]; bool color[mx]; i64 bfs(int s, int t){ int ok,u,v,sz,i; i64 path_cap; memset(pre,-1,sizeof(pre)); memset(color,0,sizeof(color)); queue < int > q; color[s] = 1; q.push(s); ok = 1; while(!q.empty() && ok){ u = q.front(); q.pop(); sz = M[u].size(); for(i=0;i<sz;i++){ v = M[u][i]; if(!color[v]... [Read More]
    Tags:
  • Convex Hull (Grahm Scan)

    By Sayef Azad Sakin
    point fp; bool cmp(const point &a,const point &b){ i64 d = isLeft(fp,a,b); if(d<0)return false; if(feq(d,(i64)0) && (dist(fp,a) > dist(fp,b)) )return false; return true; } void ConvexHull(point p[], point c[], int &np, int &nc){ int i,j,pos = 0,k; i64 dd; bool flg=0; for(i=1;i<np;i++){ if( (p[i].x < p[pos].x) || ( feq(p[i].x,p[pos].x) &&... [Read More]
    Tags:
  • Miscellaneous Geometry

    By Sayef Azad Sakin
    #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <vector> #include <map> #include <algorithm> using namespace std; [Read More]
    Tags:
  • Bellman Ford

    By Sayef Azad Sakin
    vector < pii > M[mx]; int d[mx]; bool bellman_ford(int s,int n){ int i,u,j,sz,v,w; bool done = false; for(i=0;i<n;i++)d[i] = inf; d[s] = 0; for(i=0;i<n && !done;i++){ done = true; for(u=0;u<n;u++){ sz = M[u].size(); for(j=0;j<sz;j++){ v = M[u][j].first; w = M[u][j].second; if(d[v] > (d[u] + w)){ d[v] = d[u] + w;... [Read More]
    Tags:
  • Single Source Shortest Path (Dijkstra)

    By Sayef Azad Sakin
    struct comp { bool operator() (const pii &a, const pii &b) { return a.second > b.second; } }; int color[mx], d[mx], nodes; vector < pii > path[MX]; int dijkstra(int source, int dest){ int u,v,sz,y,z; priority_queue< pii, vector< pii >,comp > q; for(v = 1; v<=nodes; v++){ color[v] = 0; d[v]... [Read More]
    Tags:
  • Bigmod (a^b%m)

    By Sayef Azad Sakin
    i64 bigmod(i64 a,i64 b,i64 d) { i64 r=1; while(b) { if(b&1) r=(r*a)%d; b>>=1; a=(a*a)%d; } return r; }
    Tags:
  • Number of Divisor

    By Sayef Azad Sakin
    i64 noOfDivisor(i64 n){ int j,f; i64 cnt,ans=1; f = 0; for(j=0;prime[j]<=n && j<prlen;j++){ cnt = 0; if(n%prime[j]==0){ while(n%prime[j]==0){ cnt++; n /= prime[j]; } f=1; ans *= (cnt+1); } } //if(!f || n!=1)cnt++; if(n^1)ans <<= 1; return ans; }
    Tags:
  • Template

    By Sayef Azad Sakin
    //Bismillahir Rahmanir Rahim //#pragma warning(disable:4786) //#pragma comment(linker,"/STACK:514850816") #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cctype> #include <cstring> #include <climits> #include <string> #include <sstream> #include <queue> #include <stack> #include <vector> #include <set> #include <map> #include <list> #include <algorithm> using namespace std; [Read More]
    Tags:
  • Prime Factorization

    By Sayef Azad Sakin
    void PrimeFact( int n, int *factors, int *factCount, int &len){ int i,count, sqrtN; sqrtN = (int) sqrt( (double) n ) + 1; for(i = 0; prime[i] < sqrtN ; i++)if(!(n%prime[i])){ factors[len] = prime[i]; count = 0; while(!(n%prime[i]))n/=prime[i], count++; factCount[len++] = count; sqrtN = (int) sqrt( (double) n ) + 1;... [Read More]
    Tags:
  • Generating Prime (Sieve)

    By Sayef Azad Sakin
    #define mx 100000 #define chkp(n) (prm[n>>6]&(1<<((n>>1)&31))) #define genp(n) (prm[n>>6]|=(1<<((n>>1)&31))) #define PrimeLimit 10000000 int prm[PrimeLimit / 64], prime[mx], prlen; void GeneratePrime(){ int i,j,sqrtN; prlen = 0; prime[prlen++]=2; sqrtN = ( int ) sqrt ( ( double ) PrimeLimit ) + 1; for(i=3;i<sqrtN;i+=2)if(!chkp(i)){ prime[prlen++] = i; for(j=(i*i);j<PrimeLimit;j+=(i<<1))genp(j); } for(;i<PrimeLimit;i+=2)if(!chkp(i))prime[prlen++]=i; } [Read More]
    Tags:
  • Bignumber Subtraction

    By Sayef Azad Sakin
    void Subtraction(char *f, char *s, char *ans){ int lenf,lens,a,carry,ind,b; lenf = strlen(f)-1; lens = strlen(s)-1; carry = ind = 0; while(lens >=0 || lenf >=0){ b = ((lens >=0)?(s[lens--]-'0'):0) + carry; if(f[lenf] >=(b+'0')){a = f[lenf--]-'0';carry = 0;} else{a = f[lenf--]-'0' + 10;carry = 1;} ans[ind++] = (a - b) +... [Read More]
    Tags:
  • Bignumber Multiplication

    By Sayef Azad Sakin
    void Multiplication(char *f, char *s, char *sum){ int lenf,lens,i,j,k,carry,a; memset(sum,0,sizeof(sum)); lenf = strlen(f);lens = strlen(s); reverse(f,f+lenf);reverse(s,s+lens); for(i=0;i < lens;i++){ carry = 0;k = i; for(j=0;j < lenf;j++){ a = ( (f[j]-'0') * (s[i]-'0') ) + carry; if(i) a += (sum[k]-'0'); sum[k++] = (a%10) + '0'; carry = a/10; } if(carry)sum[k++]... [Read More]
    Tags:
  • Bignumber Addition

    By Sayef Azad Sakin
    void Addition(char *f, char *s, char *ans){ int lenf,lens,a,carry,ind; lenf = strlen(f)-1; lens = strlen(s)-1; carry = ind = 0; while(lens > =0 || lenf > =0){ a = ((lens > =0) ? (s[lens--]-'0') : 0) + ((lenf > =0) ? (f[lenf--]-'0') : 0) + carry; ans[ind++] = (a%10) +... [Read More]
    Tags: