Fermat Theorem: Number TheoryAny number which is a perfect square gives remainder either 0 or 1, when divided by 4. Even numbers would give 0 remainder and odd would give remainder as 1. Proof: Even number can be represented as : 2*n. Square of even number = (2n)^2 = 4n...Jun 17, 2024 · 3 min readtechmadeeasy.hashnode.dev
Robin Karp Algorithmtxt -> length N (string s) pat -> length M (pattern) N>=M //To calculate hash from previous hash // hash( txt[s+1 .. s+m] ) = ( d ( hash( txt[s .. s+m-1]) – txt[s]*h ) + txt[s + m] ) mod q // hash( txt[s .. s+m-1] ) : Hash value at sh...Jul 13, 2022 · 2 min readtechmadeeasy.hashnode.dev
C++ Notes📌 Find Function //For Maps map<int,int>mp; mp.insert({2,3}); mp.insert({1,5}); if(mp.find(2) != mp.end()) cout<<mp.find(2)->second; //Output = 3 else cout<<"Not Found"; mp.find(3)->second //outputs 0, not present. //Time Complexi...Jun 12, 2022 · 7 min readtechmadeeasy.hashnode.dev