Questions tagged as 'hashcode'

2
answers

What is the purpose of the GetHashCode () method?

I am using Resharper to automate overwriting of the Equals method and the == operator. One of the methods the tool overwritten is GetHashCode : public override int GetHashCode() { unchecked { return (Id.GetH...
asked by 20.03.2017 / 14:14
1
answer

Why does String hashCode () in Java use 31 as a multiplier?

In Java, the hash code for an object String is computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] using integer arithmetic, where s[i] is the i -th character of the string, n is the length of the string,...
asked by 02.01.2019 / 17:54
2
answers

What is the most efficient way to calculate the HashCode of an object in Javascript?

I'm currently using Object.prototype.GetHashCode = function () { var s = this instanceof Object ? JSON.stringify(this) : this.toString(); var hash = 0; if (s.length === 0) return hash; for (var i = 0; i < s.length; ++i) {...
asked by 17.12.2013 / 16:09
1
answer

How to check if the list is empty or with an element in C

typedef struct { int tamanho; nodo *inicio; } lista; typedef struct { lista **vet; int tamTabHash; int colisoes; } tabHash; tabHash *criaTabelaHash(int tamanho){ if(tamanho < 1) return NULL; tabHash* hash = (tabH...
asked by 04.07.2018 / 03:13
2
answers

save a data type to a file in c language

I have this data structure: typedef struct { ListaCartao tabelaCartao[HASHSIZE]; ListaArtigos tabelaArtigos[HASHSIZE]; char localidade[MAXLOCALIZACAO]; }tCelulaSuperdume, *SuperDume; SuperDume superMercadoLocal[CONJUNTOSUPERDUME];...
asked by 09.05.2015 / 03:58