if you want to remove an article from website contact us from top.

    which of the following statements hold good about hashing technique

    Mohammed

    Guys, does anyone know the answer?

    get which of the following statements hold good about hashing technique from screen.

    Solved Which of the following statements about hashing is

    Answer to Solved Which of the following statements about hashing is

    Skip to main content

    Question: Which Of The Following Statements About Hashing Is False? A Good Hash Function Maps Similar Data Items Or Records To The Same Hash Values. A Good Hash Function Uniformly Distributes Data Items Across The Entire Set Of Possible Hash Values. A Perfect Hash Function Allows For Constant Time Search, Insertion, And Deletion, Into And From A Hash Table. When Using

    Show transcribed image text

    Expert Answer

    Question : which of the followi…

    View the full answer

    Transcribed image text: Which of the following statements about hashing is false? A good hash function maps similar data items or records to the same hash values. A good hash function uniformly distributes data items across the entire set of possible hash values. A perfect hash function allows for constant time search, insertion, and deletion, into and from a hash table. When using an open addressing method of collision resolution, all data records reside in a single bucket array.

    © 2003-2022 Chegg Inc. All rights reserved.

    स्रोत : www.chegg.com

    Practice Problems on Hashing

    A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

    Practice Problems on Hashing

    Difficulty Level : Easy

    Last Updated : 08 Jul, 2021

    In this article, we will discuss the types of questions based on hashing. Before understanding this, you should have idea about hashing, hash function, open addressing and chaining techniques (see: Introduction, Separate chaining, Open addressing).

    These are some key points in hashing:

    The purpose of hashing is to achieve search, insert and delete an element in complexity O(1).

    Hash function is designed to distribute keys uniformly over the hash table.

    Load factor α in hash table can be defined as number of slots in hash table to number of keys to be inserted.

    For open addressing, load factor α is always less than one.

    The complexity of insertion, deletion and searching using open addressing is 1/(1-α).

    The complexity of insertion, deletion and searching using chaining method is (1+α).

    These are the types of questions asked in hashing.

    Type 1: Calculation of hash values for given keys –

    In this type of questions, hash values are computed by applying given hash function on given keys.

    Que – 1. Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function x mod 10, which of the following statements are true? (GATE CS 2004)

    i. 9679, 1989, 4199 hash to the same value

    ii. 1471, 6171 hash to the same value

    iii. All elements hash to the same value

    iv. Each element hashes to a different value

    (A) i only (B) ii only (C) i and ii only (D) iii or iv

    Solutions: Using given hash function h(x) = x mod 10

    h(9679) = 9679%10 = 9

    h(1989) = 1989%10 = 9

    h(4199) = 4199%10 = 9

    h(1471) = 1471%10 = 1

    h(6171) = 6171%10 = 1

    As we can see, 9679, 1989 and 4199 hash to same value 9. Also, 1471 and 6171 hash to same value 1. Therefore, statement (i) and (ii) are correct which match with option (C).

    Type 2: Insertion of keys into hash table using linear probing as collision resolution technique –

    In linear probing technique, collision is resolved by searching linearly in the hash table until an empty location is found.

    Que – 2. The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of length 10 using open addressing with hash function h(k) = k mod 10 and linear probing. What is the resultant hash table?

    Solution: Keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted in hash table as:

    For key 12, h(12) is 12%10 = 2. Therefore, 12 is placed at 2nd index in the hash table.

    For key 18, h(18) is 18%10 = 8. Therefore, 18 is placed at 8th index in the hash table.

    For key 13, h(13) is 13%10 = 3. Therefore, 13 is placed at 3rd index in the hash table.

    For key 2, h(2) is 2%10 = 2. However, index 2 is already occupied with 12. Therefore, using linear probing, 2 will be placed at index 4 as index 2 and 3 are already occupied.

    For key 3, h(3) is 3%10 = 3. However, index 3 is already occupied with 13. Therefore, using linear probing, 3 will be placed at index 5 as index 3 and 4 are already occupied.

    Similarly, 23, 5 and 15 will be placed at index 6, 7, 9 respectively.

    Therefore, correct option is (C).

    Alternative Approach: We can also solve this using elimination approach as:

    Option (A) and (B) are incorrect as all keys are not inserted in hash table.

    Option (D) is incorrect as some indexes in hash table have more than one key which never happens using linear probing.

    Remaining option is (C) which is the answer.

    Type 3: Given a hash table with keys, verify/find possible sequence of keys leading to hash table –

    For a given hash table, we can verify which sequence of keys can lead to that hash table. However, to find possible sequences leading to a given hash table, we need to consider all possibilities.

    Que – 3. A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below.

    Which one of the following choices gives a possible order in which the key values could have been inserted in the table?

    (A) 46, 42, 34, 52, 23, 33

    (B) 34, 42, 23, 52, 33, 46

    (C) 46, 34, 42, 23, 52, 33

    (D) 42, 46, 33, 23, 34, 52

    Solution: We will check whether sequence given in option A can lead to hash table given in question. Option A inserts 46, 42, 34, 52, 23, 33 as:

    For key 46, h(46) is 46%10 = 6. Therefore, 46 is placed at 6th index in the hash table.

    For key 42, h(42) is 42%10 = 2. Therefore, 42 is placed at 2nd index in the hash table.

    For key 34, h(34) is 34%10 = 4. Therefore, 34 is placed at 4th index in the hash table.

    For key 52, h(52) is 52%10 = 2. However, index 2 is occupied with 42. Therefore, 52 is placed at 3rd index in the hash table. But in given hash table, 52 is placed at 5th index. Therefore, sequence in option A can’t generate hash table given in question.

    In the similar way, we can check for other options as well which leads to answer as (C).

    स्रोत : www.geeksforgeeks.org

    Hashing Techniques

    This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Hashing techniques”. 1. If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected number of collisions involving a particular key x is : a) Less than 1 b) Less ... Read more

    Database Questions and Answers – Hashing techniques

    « Prev Next »

    This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Hashing techniques”.

    1. If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected number of collisions involving a particular key x is :

    a) Less than 1 b) Less than n c) Less than m d) Less than n/2 View Answer

    2. A technique for direct search is

    a) Binary Search b) Linear Search c) Tree Search d) Hashing View Answer

    3. The searching technique that takes O (1) time to find a data is

    a) Linear Search b) Binary Search c) Hashing d) Tree Search View Answer

    Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

    advertisement

    4. The goal of hashing is to produce a search that takes

    a) O(1) time b) O(n2 )time c) O(log n ) time d) O(n log n ) time View Answer

    5. Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4)mod7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an empty location in the table.

    a) 8, _, _, _, _, _, 10

    b) 1, 8, 10, _, _, _, 3

    c) 1, _, _, _, _, _,3

    d) 1, 10, 8, _, _, _, 3

    View Answer

    Check this: RDBMS MCQ | Computer Science MCQs

    6. A hash table can store a maximum of 10 records, currently there are records in location 1, 3,4,7,8,9,10. The probability of a new record going into location 2, with hash functions resolving collisions by linear probing is

    a) 0.1 b) 0.6 c) 0.2 d) 0.5 View Answer

    7. Key value pairs is usually seen in

    a) Hash tables b) Heaps

    c) Both Hash tables and Heaps

    d) Skip list View Answer advertisement

    8. What is the best definition of a collision in a hash table?

    a) Two entries are identical except for their keys

    b) Two entries with different data have the exact same key

    c) Two entries with different keys have the same exact hash value

    d) Two entries with the exact same key have different hash values

    View Answer

    9. Which of the following scenarios leads to linear running time for a random search hit in a linear-probing hash table?

    a) All keys hash to same index

    b) All keys hash to different indices

    c) All keys hash to an even-numbered index

    d) All keys hash to different even-numbered indices

    View Answer advertisement

    10. Breadth First Search is used in

    a) Binary trees b) Stacks c) Graphs

    d) All of the mentioned

    View Answer

    Sanfoundry Global Education & Learning Series – Database Management System.

    To practice all areas of Database Management System, here is complete set on 1000+ Multiple Choice Questions and Answers on Database Management System.

    « Prev - Database Questions and Answers – Ordered Indices

    » Next - Database Questions and Answers – Ordered Indexing and Hashing

    Next Steps:

    Get Free Certificate of Merit in Database Management System

    Participate in Database Management System Certification Contest

    Become a Top Ranker in Database Management System

    Take Database Management System Tests

    Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

    Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

    Related Posts:

    Buy Computer Science Books

    Practice Programming MCQs

    Apply for Information Technology Internship

    Apply for DBMS Internship

    Practice RDBMS MCQ advertisement

    Recommended Articles:

    Database Questions and Answers – Ordered Indexing and Hashing

    RDBMS Questions and Answers – Dynamic Hashing

    Double Hashing Multiple Choice Questions and Answers (MCQs)

    RDBMS Questions and Answers – Static Hashing

    C++ Program to Implement Hash Tables with Double Hashing

    Hashing Functions Multiple Choice Questions and Answers (MCQs)

    Digital Communications Questions and Answers – Multiple Access Techniques for LAN and Access Algorithms

    Database Questions and Answers – Encryption and Its Applications

    Database Questions and Answers – Application Performance

    C Program to Implement Hash Tables with Double Hashing

    advertisement

    Additional Resources:

    Data Structures in C

    Data Structures in Java

    Data Structures in C++

    Python Programs on Trees

    Tree Programs in Java

    Popular Pages:

    C Programming Examples on Trees

    Data Structure MCQ Questions

    Database Management System MCQ Questions

    Tree Programs in C++

    C Programs on Recursion

    स्रोत : www.sanfoundry.com

    Do you want to see answer or more ?
    Mohammed 7 day ago
    4

    Guys, does anyone know the answer?

    Click For Answer