hashing function

Sign up for a GitHub account Sign in All Gists qpfiffer / gist:674796 Created November 12, 2010 Code Revisions 1 /.sunken-menu-group /.sunken-menu-contents Embed HTTPS SSH You can clone with HTTPS or SSH . Download Gist /.only-with-full-nav hashing function View gist:674796 gistfile1.cpp Raw File suppressed. Click to show. 1 2 3 4 5 6 7 8 9 10 11 12 // I think this works correctly... int stringSize = strlen(s); int i ( 0 ), j( 0 ); int runTotal ( 0 ); for (;i<stringSize;i++) { int temp = ( int )s[i]; for (j= 0 ;j<(stringSize-(i+ 1 ));j++) { temp *= 31 ; } runTotal += temp; } return runTotal; Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment /.discussion-timeline /....

Linked on 2015-06-08 06:21:54 | Similar Links