Skip to Content
author's profile photo Former Member
Former Member

Hash Tables

Hi Gurus

Can Any body explain me about HASH Tables(Advantages&disadvantages)Using this?

Thanks in advance

kalyan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Aug 28, 2007 at 02:35 AM

    Hi kalyan,

    hash tables are sorted using Hash algorithm, so here you need not to sort it again.

    kishore

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 28, 2007 at 03:08 AM

    Hi,

    A hased table is the kind of an internal table which is closest to a database table.

    The fundamental difference is that the entries in a hashed table cannot be accessed through an index.

    For example, the following statement is not applicable to a hashed table -

    READ TABLE ITAB INDEX <n>.

    If you notice, even in case of a database table, let us say, SPFLI, we cannot say, "get me the 10th record of the table SPFLI". The entries can only be retrieved by specifying a "key". So you would have something like -

    READ TABLE ITAB WITH KEY....

    This is similar to a SELECT statement that we use for a database table. We specify the key fields in the WHERE condition.

    Obviously, a hashed table has to have a KEY, and cannot have duplicate entries for the key fields. Which is again just like in case of a database table.

    And finally, even though it is only used rarely, in some cases using a hashed table can improve the performance significantly - the reason being that the time required to fetch any record from a hashed internal table is constant.

    Read this article about hashing techniques: http://en.wikipedia.org/wiki/Hash_table#Time_complexity_and_common_uses_of_hash_tables

    Also check the link, here is sample code available, it will help u.

    http://www.sap-img.com/abap/what-is-use-of-using-hashed-table.htm

    Regards,

    Priyanka

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 28, 2007 at 03:40 AM

    Hi Kalyan..

    <b>Hashed Table Features:</b>

    In this internal table system will not maintain the index. So we can access the records only using KEY.

    Key must be always UNIQUE.

    To access a record it will pass the Keyfield values to a HAsh algorithm which returns the Address of the Record.

    <b>Advantages:</b>

    Access time to a record is Constant in Hashed table .. So it will be efficient.

    Very large internal tables can be declared as Hashed tables since Access time will not vary based on the No of records.

    <b>Disadvantages:</b>

    We cannot access them using index

    We cannot store duplicate rows in hashed table. It will give a runtime error.

    <b>Reward if Helpful</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 01, 2007 at 04:00 AM

    Good

    thanq for u r answer

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.