Your SlideShare is downloading. ×
0
(Tablas Hash) Virgilio Garcia Garcia
(Tablas Hash) Virgilio Garcia Garcia
(Tablas Hash) Virgilio Garcia Garcia
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

(Tablas Hash) Virgilio Garcia Garcia

598

Published on

Published in: Sports
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
598
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. <ul><li>Object: para obtener una Tabla Hash genérica. </li></ul><ul><li>Aprovechamos función hashCode() de object. </li></ul><ul><li>El resultado de la función hashCode() se mapea al espacio de direcciones del array de la tabla hash usando %b: </li></ul><ul><li>(posicion=clave.hashCode()%b) </li></ul><ul><li>b= tamaño del array de la tabla hash. </li></ul>
  • 2. Función Resumen (hashCode() <ul><li>Por defecto calcula el hashcode convirtiendo dirección interna del objeto en un número entero. </li></ul><ul><li>En el caso de Mercancía sobrecargamos para devolver el código: </li></ul><ul><li>public int hashCode(){ </li></ul><ul><ul><li>return codigo; </li></ul></ul><ul><ul><li>} </li></ul></ul>
  • 3. Funcion insertar() <ul><li>public void insertar(Object o){ </li></ul><ul><li>tabla[buscaCasilla(String.valueOf(o.hashCode()))%b]=o; </li></ul><ul><li>} </li></ul><ul><li>Virgilio García García </li></ul><ul><li> i1656157 </li></ul>

×