very fast insertion and searching.
insertion and searching can take close to constant time: O(1) in big O notation.
hash tables are relatively easy to program.
disadvantages.
based on arrays, and arrays are difficult to expand.
For some kinds of hash tables, performance may degrade catastrophically when a table becomes too full, so the programmer needs to have a fairly accurate idea of how many data items will need to be stored (or be prepared to periodically transfer data to a larger hash table, a time-consuming process).
Also, there’s no convenient way to visit the items in a hash table in any kind of order (such as from smallest to largest). If you need this capability, you’ll need to look elsewhere.
However, if you don’t need to visit items in order, and you can predict in advance the size of your database, hash tables are unparalleled in speed and convenience.
very fast insertion and searching.
insertion and searching can take close to constant time: O(1) in big O notation.
hash tables are relatively easy to program.
disadvantages.
based on arrays, and arrays are difficult to expand.
For some kinds of hash tables, performance may degrade catastrophically when a table becomes too full, so the programmer needs to have a fairly accurate idea of how many data items will need to be stored (or be prepared to periodically transfer data to a larger hash table, a time-consuming process).
Also, there’s no convenient way to visit the items in a hash table in any kind of order (such as from smallest to largest). If you need this capability, you’ll need to look elsewhere.
However, if you don’t need to visit items in order, and you can predict in advance the size of your database, hash tables are unparalleled in speed and convenience.
การแปล กรุณารอสักครู่..