mirror of
https://github.com/Hizenberg469/Algorithms-snippets.git
synced 2026-04-19 22:52:23 +03:00
Graph, Number Theory, String Hashing Algo added
This commit is contained in:
12
Number Theory/extended_gcd_recursive.cpp
Normal file
12
Number Theory/extended_gcd_recursive.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//Extended gcd -> Recursive
|
||||
|
||||
tuple<int,int,int> extended_gcd( int a, int b){
|
||||
|
||||
if( b == 0 ){
|
||||
return {1,0,a};
|
||||
}
|
||||
|
||||
int x,y,g;
|
||||
tie(x,y,g) = extended_gcd( b , a%b );
|
||||
return {y , x - (a/b)*y , g};
|
||||
}
|
||||
Reference in New Issue
Block a user