page230.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 45 行
HTML
45 行
<HTML><HEAD><TITLE>Scatter Tables</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html3848" HREF="page231.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3846" HREF="page205.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3840" HREF="page229.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3850" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H1><A NAME="SECTION008500000000000000000">Scatter Tables</A></H1><P>The separately chained hash table described in the preceding sectionis essentially a linked-list implementation.We have seen both linked-list and array-based implementationsfor all of the data structures considered so farand hash tables are no exception.Array-based hash tables are called <em>scatter tables</em><A NAME=11407> </A>.<P>The essential idea behind a scatter table is thatall of the information is stored within a fixed size array.Hashing is used to identify the position where an item should be stored.When a collision occurs,the colliding item is stored somewhere else in the array.<P>One of the motivations for using scatter tables can be seen byconsidering again the linked-list hash table shown in Figure <A HREF="page224.html#fighash1"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.Since most of the linked lists are empty,much of the array is unused.At the same time, for each item that is added to the table,dynamic memory is consumed.Why not simply store the data in the unused array positions?<P><BR> <HR><UL> <LI> <A NAME="tex2html3851" HREF="page231.html#SECTION008510000000000000000">Chained Scatter Table</A><LI> <A NAME="tex2html3852" HREF="page237.html#SECTION008520000000000000000">Average Case Analysis</A></UL><HR><A NAME="tex2html3848" HREF="page231.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html3846" HREF="page205.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html3840" HREF="page229.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html3850" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright © 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a> All rights reserved.</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?