30.05.2013 Views

Appunti per il modulo di algoritmi e strutture dati - Sezione di ...

Appunti per il modulo di algoritmi e strutture dati - Sezione di ...

Appunti per il modulo di algoritmi e strutture dati - Sezione di ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

(a)<br />

(b)<br />

Figura 15: Numeri naturali memorizzati in un array con <strong>il</strong> metodo hash ad in<strong>di</strong>rizzamento a<strong>per</strong>to e legge<br />

<strong>di</strong> scansione lineare. Il valore -1 in<strong>di</strong>ca una cella vuota, <strong>il</strong> -2 una cella cancellata.<br />

in questo caso potremmo ut<strong>il</strong>izzare <strong>il</strong> valore -2. La procedura hashInsert va mo<strong>di</strong>ficata in modo da<br />

considerare come <strong>di</strong>sponib<strong>il</strong>e <strong>per</strong> un inserimento una cella precedentemente cancellata.<br />

}<br />

int hashInsert ( int *A , int n, int x) {<br />

int i=h(x);<br />

for ( int j =0; j

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!