合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

        代做00301J 、Java設(shè)計編程代寫
        代做00301J 、Java設(shè)計編程代寫

        時間:2024-10-09  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



        Data Structures and Algorithms Hash Tables 
        CRICOS Provide Code: 00301J Page 1 of 3 
         
        Note: 
        • hashArray stores the key, value and state (used, free, or previously-used) 
        of every hashEntry. 
        We must store both the key and value since we need to check hashArray 
        to tell if there is a collision and we should keep probing until we find the 
        right key. 
        • put(), hasKey() and get() must take the passed-in key and call hash() to 
        convert the key into an integer. This integer is then used as the index for 
        hashArray. 
        • Java Students: If you use a private inner class for DSAHashEntry, then 
        put(DSAHashEntry will need to be private, otherwise it will be public. 
        • There are many hash functions in existence, but all hash functions must 
        be repeatable (i.e., the same key will always give the same index). A good 
        hash function is fast and will distribute keys evenly inside hashArray. 
        Hash Tables 
         
        Updated: 21st 
        July, 2023 
         
        Aims 
        • To implement a hash table. 
        • To make the above hash table automatically resize. 
        • To save the hash table and reload it from a file. 
         
        Before the Practical 
        • Read this practical sheet fully before starting. 
         
        Activities 

        1. Hash Table Implementation 
        Following the lecture slides as a guide, Create DSAHashTable class and a companion 
        class called DSAHashEntry to implement a hash table with a simple hash function. Use 
        linear probing first since it’s easier to think about, then convert to double-hashing. 
        Assume the keys are strings and the values are Objects. 
         Data Structures and Algorithms Hash Tables 
        CRICOS Provide Code: 00301J Page 2 of 3  
         
        Note: 
        • Of course, the latter depends on the distribution of the keys as well, so it’s 
        not easy to say what a good hash function will be without knowing the 
        keys. 
        For the purpose of this practical, just use one of the hash functions from 
        the lecture notes. 
        • Use linear probing or double-hashing to handle collisions when inserting. 
        • hasKey(), get() and remove() will need to use the same approach since 
        they also need to find the right item. 
        It’s probably a good idea to try make a private find() method that does 
        the probing for these three functions and returns the index to use. Use the 
        DSAHashEntry state to tell you when to stop probing. 
        • Be aware that remove() with probing methods adds the problem that it 
        can break probing unless additional measures are taken. 
        – In particular, say we added Key1, then Key2 which collides with 
        Key1, so we linearly probe and add Key2 to the next entry. 
        If we remove Key1, later attempts to get Key2 will fail because Key2 
        maps to where Key1 used to be. 
        Since it is now null, probing will abort and imply that Key2 doesn’t 
        exist. 
        – The solution is to use the state filed in DSAHashEntry that tracks 
        whether the entry has been used before or not. 
         
        2. Resizing a Hash Table 
        Modify your DSAHashTable to allow it to resize. There are various ways to determine 
        when to and how to resize a hash table. 
         
        The simplest way to determine when is to set an upper and lower threshold value 
        for the load factor. When the number of elements is outside of this, the put() or 
        remove() methods should call resize(size) automatically. 
        • Remember, this will be computationally expensive (what is it it in Big-O?), so it is 
        important not to set the threshold too low. Also, collisions occur more frequently 
        at higher load factors, thus it is equally important to not set the threshold too 
        high. Do some research to find "good" values. 
        A simple way to resize is to create a new array, then iterate over hashArray (ignoring 
        unused and previously used slots) and re-hashing (using put(). 
        • To select a suitable size for the new array, you can either use a "look up" table of 
        suitable primes or re-calculate a new prime after doubling/halving the previous 
        size. 
        Test your resize functionality with a small hash table size, just so you know it will 
        work when you increase the size of the table. Data Structures and Algorithms Hash Tables 
        CRICOS Provide Code: 00301J Page 3 of 3 
         
         
        3. File I/O 
        To truly test your hash table implementation, you will need a large dataset. Read in 
        the RandomNames7000.csv as input to insert values into your hash table. There are some 
        duplicates in the file, so your program should be able to handle them. 
         
        It is also useful to be able to save the hash table. The save order is not important, 
        so just iterate through the keys and values in the order they are stored in the hash 
        table and write it to a .csv. 
         
        Submission Deliverable 
        • Your code are due 2 weeks from your current tutorial session. 
        – You will demonstrate your work to your tutors during that session 
        – If you have completed the practical earlier, you can demonstrate your work 
        during the next session 
        • You must submit your code and any test data that you have been using electronically
        via Blackboard under the Assessments section before your demonstration. 
        – Java students, please do not submit the *.class files 
         
        Marking Guide 
        Your submission will be marked as follows: 
        • [6] Your DSAHashTable and DSAHashEntry are implemented correctly. 
        • [4] Your hash function is well thought out and properly implemented. 
        This means that it meets at least the first three criteria of a good hash function and 
        you can argue that it at least partially meets the last. 
        • [5] Your hash table resizes as you put and remove hash entries. 
        • [5] You can read in and save .csv files. 
        End of Worksheet 

        請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp

        掃一掃在手機(jī)打開當(dāng)前頁
      1. 上一篇:漫蛙漫畫2024官方正版在線免費閱讀平臺入口在哪?
      2. 下一篇:代做CITS2002、C/C++語言程序代寫
      3. 無相關(guān)信息
        合肥生活資訊

        合肥圖文信息
        挖掘機(jī)濾芯提升發(fā)動機(jī)性能
        挖掘機(jī)濾芯提升發(fā)動機(jī)性能
        戴納斯帝壁掛爐全國售后服務(wù)電話24小時官網(wǎng)400(全國服務(wù)熱線)
        戴納斯帝壁掛爐全國售后服務(wù)電話24小時官網(wǎng)
        菲斯曼壁掛爐全國統(tǒng)一400售后維修服務(wù)電話24小時服務(wù)熱線
        菲斯曼壁掛爐全國統(tǒng)一400售后維修服務(wù)電話2
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國24小時客服熱線
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國24小時
        海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
        海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士3號線
        合肥機(jī)場巴士3號線
        合肥機(jī)場巴士2號線
        合肥機(jī)場巴士2號線
      4. 幣安app官網(wǎng)下載 短信驗證碼 丁香花影院

        關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

        Copyright © 2024 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
        ICP備06013414號-3 公安備 42010502001045

        主站蜘蛛池模板: 精品国产一区二区三区免费看| 欧洲精品码一区二区三区| 精品一区精品二区制服| 国产成人精品日本亚洲专一区| 成人免费视频一区二区三区| 久久久精品一区二区三区| 国产在线一区二区三区av| 人妖在线精品一区二区三区| 亚洲电影国产一区| 精品国产毛片一区二区无码| 国产成人午夜精品一区二区三区| 亚洲一区免费视频| 亚洲视频在线一区| 日韩精品无码免费一区二区三区| 亚洲综合av永久无码精品一区二区| 亚洲av无码一区二区三区天堂 | 无码国产精成人午夜视频一区二区 | 精品无码成人片一区二区98 | 麻豆精品久久久一区二区| 国产精品日本一区二区在线播放 | 国产麻豆精品一区二区三区| 精品人妻中文av一区二区三区| 亚洲啪啪综合AV一区| 国产成人精品日本亚洲专一区 | 国产精品女同一区二区| 四虎成人精品一区二区免费网站| 亚洲人成人一区二区三区| 色婷婷亚洲一区二区三区| 国产在线观看一区精品| 亚洲无人区一区二区三区| 制服中文字幕一区二区| 一区二区传媒有限公司| 亚洲一区二区三区AV无码| 极品少妇一区二区三区四区| 精品少妇人妻AV一区二区三区| 91在线精品亚洲一区二区| 亚洲美女高清一区二区三区 | 蜜臀AV在线播放一区二区三区| 一区二区在线视频| 国模大尺度视频一区二区| 国产aⅴ精品一区二区三区久久 |