99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

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

CSE2425代寫(xiě)、C++編程語(yǔ)言代做
CSE2425代寫(xiě)、C++編程語(yǔ)言代做

時(shí)間:2024-12-09  來(lái)源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



CSE2425, C programming lab, course 2020-2021
Final assignment: Hash map
1 Introduction
In this final assignment you will implement a hash map
1
. A hash map is a data
structure that associates a key with a value (a chunk of data). Most hash maps
are implemented as an array of so-called buckets. A hash function translates
a given key (e.g., a name) to an index in the array, where the corresponding
bucket is stored.
Below we will specify the data structures that you have to provide, and the
functions that you have to implement. This assignment includes two bonus
functions that can raise your score from pass (C) to good (B) to excellent (A).
2 Testing
The first part of the assignment consist of implementing a test set for the hash
map. We have created a number of incorrect hash map implementations. The
goal is to create a test set on which these incorrect implementations fail. When
you have finished creating this test set, you can use this test set to test your own
implementation by copy&pasting it into the my tests of the Hashmap assignment
in Weblab.
3 Hash map structure
Define a type HashMap, which represents the hash map data structure.
Note: Use typedef such that a HashMap structure can be used without using
the struct keyword, i.e. the following construction should be possible:
HashMap *hm;
4 Creating a hash map
1. Implement a function create_hashmap that returns a pointer to the newly
constructed HashMap structure and has parameter
ˆ key_space, a size_t
2
that represents the number of buckets in the hash
map.
1http://en.wikipedia.org/wiki/Hashmap
2http://en.wikipedia.org/wiki/Size_t
1CSE2425, C programming lab, course 2020-2021
This function should allocate enough memory to fit key_space buckets, and the
allocated memory should be zeroed (i.e., NULLed).
2. A hash function maps a string (i.e. an array of chars ending with a null
character) to an index, so it returns a unsigned int. The parameter of a hash
function is simply a
ˆ key, a null-terminated string of characters.
As the hash map can only hold up to key_space buckets, using the hash function
–for example to lookup a mapping– requires some care; apply modulo key_space
to the result such that the value will be in the available bucket range.
3. A default hash function named hash should be implemented. This function
should sum all ASCII values of the characters of the key.
For example:
char *key = "AC";
unsigned int h = hash(key);
=> h = 1**
5 Inserting data
Implement a function insert_data that has parameters
ˆ hm, a pointer to a hash map;
ˆ key, a null-terminated string of characters;
ˆ data, a void pointer to the source data;
ˆ resolve_collision, a ResolveCollisionCallback (see below).
The function should store the data pointer and a copy of the key in the bucket
that can be found by applying the hash function on the key. In case of a
collision, i.e. when there already is data with the same key in the hash map, the
resolve_collision function should be called with the the previously stored
data and data as arguments and the returned void pointer should be stored in
the bucket instead.
ResolveCollisionCallback, a pointer to a function that returns a void pointer
and has two parameters:
ˆ old_data, a void pointer to the previously stored data;
ˆ new_data, a void pointer to the data that is being newly inserted.
The function should determine what data is stored in the has map in case of a
key collision by returning the void pointer to the data that is to be stored.
2CSE2425, C programming lab, course 2020-2021
6 Retrieving data
Implement a function get_data that has parameters
ˆ hm, a pointer to a hash map;
ˆ key, a null-terminated string of characters.
The function should return the data pointer (a void pointer) in the hash map
that is associated with the key. If the key is not present in the hash map, NULL
should be returned.
7 Iterator
Implement a function iterate that has parameters
ˆ hm, a pointer to a hash map;
ˆ callback, a pointer to a function that returns nothing (i.e. void) and has
two parameters:
– key, a null-terminated string of characters;
– data, a void pointer to the data.
This function should iterate over the entire hash map. For each data element
it finds, the callback function should be called with the two members of the
element.
8 Removing data
Implement a function remove_data that has parameters
ˆ hm, a pointer to a hash map;
ˆ key, a null-terminated string of characters.
ˆ destroy_data, a DestroyDataCallback (see below).
This function should remove the element in the hash map that is associated with
the given key. If the destroy_data parameter is non-NULL it should be called
with the data pointer of the element as argument. If the key is not present, the
hash map should remain untouched. As the remove_data function cannot fail,
its return type is void.
DestroyDataCallback, a pointer to to a function that returns nothing (i.e.
void) and has one parameter:
ˆ data, a void pointer.
The function should clean up the data (e.g. free allocated memory).
3CSE2425, C programming lab, course 2020-2021
9 Deleting a hash map
Implement a function delete_hashmap that has parameters
ˆ hm, a pointer to the hash map that is to be deleted;
ˆ destroy_data, a DestroyDataCallback (see 8).
The function should deallocate all memory that was allocated by the hash map.
If the destroy_data parameter is non-NULL it should be called for every data
element that is stored in the hash map with the data pointer of the element as
argument.
10 Bonus: New hash function
Implement a function set_hash_function that has parameters
ˆ hm, a pointer to a hash map;
ˆ hash_function, a pointer to a hash function that returns a unsigned int
and a single parameter:
– key, a null-terminated string of characters.
This function should set hash_function as the new hash function of the hash
map hm. Changing the hash function means that a particular key may now be
hashed to different bucket than it was with the previous hash function. The
hash map must be updated (rehashed) to reflect this so that all data in the
hash map can still be retrieved with their corresponding keys.
11 Bonus: Counting Words
Implement a function count_words that has parameters
ˆ stream, a pointer to a FILE.
This function should count the number of times each word in the stream occurs
using the hash map you implemented. A word is defined as a sequence of one or
more alphanumeric characters (case sensitive). You may use fscanf
3
to read a
particular set of characters from a stream but other solutions are also accepted.
The data stored in the hash map should be properly allocated and deallocated,
do not simply store an integer that is cast to a pointer type. The return type
of the function is void.
3http://en.cppreference.com/w/c/io/fscanf
4CSE2425, C programming lab, course 2020-2021
Given the input:
foo bar_, foo!
bar "baz".
foo?
The program should write the following to the standard output:
bar: 2
baz: 1
foo: 3
The order in which the output is printed is not important.
12 Submission
The assignment should be implemented on Weblab.
ˆ All test code should be located in the Testing assignment.
ˆ All hash map code should be located in the Hashmap assignment.
ˆ Put all the word count source code inside the Wordcount assignment;
ˆ If you have implemented the first bonus exercise, add the following macro
to your Hashamp submission:
#define NEW_HASH
ˆ Do not include a main function. (We will use our own test driver, just like
the example test provided.)
Submissions violating the above requirements will be automatically rejected by
the Weblab system.


請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp

掃一掃在手機(jī)打開(kāi)當(dāng)前頁(yè)
  • 上一篇:COMP42215代做、代寫(xiě)Python設(shè)計(jì)程序
  • 下一篇:CS-350代寫(xiě)、C++編程語(yǔ)言代做
  • 無(wú)相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    出評(píng) 開(kāi)團(tuán)工具
    出評(píng) 開(kāi)團(tuán)工具
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
    合肥機(jī)場(chǎng)巴士4號(hào)線(xiàn)
    合肥機(jī)場(chǎng)巴士4號(hào)線(xiàn)
    合肥機(jī)場(chǎng)巴士3號(hào)線(xiàn)
    合肥機(jī)場(chǎng)巴士3號(hào)線(xiàn)
    合肥機(jī)場(chǎng)巴士2號(hào)線(xiàn)
    合肥機(jī)場(chǎng)巴士2號(hào)線(xiàn)
    合肥機(jī)場(chǎng)巴士1號(hào)線(xiàn)
    合肥機(jī)場(chǎng)巴士1號(hào)線(xiàn)
  • 短信驗(yàn)證碼 豆包 幣安下載 AI生圖 目錄網(wǎng)

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

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

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          亚洲激情网站| 欧美视频在线观看| 国产一区二区高清不卡| 99天天综合性| 久久亚洲综合| 激情综合网激情| 新片速递亚洲合集欧美合集| 国产精品vip| 99在线精品视频在线观看| 欧美电影在线观看| 亚洲国产高潮在线观看| 久久综合九九| 伊甸园精品99久久久久久| 久久精品视频在线播放| 国产欧美一区二区在线观看| 亚洲欧美综合精品久久成人| 国产精品成人一区二区三区夜夜夜 | 国产精品综合av一区二区国产馆| 亚洲大片免费看| 欧美专区18| 国产一区二区无遮挡| 久久久99久久精品女同性 | 欧美视频在线观看| 99精品热6080yy久久 | 亚洲精品国产欧美| 欧美日韩国产综合一区二区| 99ri日韩精品视频| 国产精品国产三级国产| 亚洲视频在线一区| 欧美日韩一区二区在线视频 | 99精品热视频只有精品10| 葵司免费一区二区三区四区五区| 国产日韩成人精品| 欧美一二区视频| 国产精品欧美风情| 亚洲一区二区动漫| 欧美性猛片xxxx免费看久爱| 99国产精品视频免费观看| 欧美日韩三级电影在线| 夜夜嗨av一区二区三区| 欧美日韩国产免费| 99v久久综合狠狠综合久久| 欧美日韩美女| 99视频超级精品| 国产精品毛片va一区二区三区| 在线观看视频一区| 欧美高清免费| 一区二区三区**美女毛片| 欧美日韩视频在线第一区| 99国产精品久久久久久久| 欧美日本亚洲韩国国产| 亚洲少妇诱惑| 国产欧美日韩不卡| 久久久久久黄| 亚洲国产成人久久综合一区| 欧美国产日本| 亚洲一区二区三区久久| 国产亚洲人成网站在线观看| 久久久视频精品| 亚洲日本中文字幕区| 久久成人人人人精品欧| 狠狠入ady亚洲精品经典电影| 久久久久久综合网天天| 亚洲国产一区二区三区a毛片| 欧美成人午夜激情在线| 中文精品一区二区三区| 国产精品一区二区三区四区五区 | 日韩天天综合| 国产精品a级| 久久久久久9| 亚洲国产欧洲综合997久久| 欧美日本精品| 久久精品国产欧美激情| 亚洲人成网站在线观看播放| 国产精品成人aaaaa网站| 久久成年人视频| 亚洲免费观看高清完整版在线观看熊| 国产精品久久久久高潮| 久久影院午夜片一区| 亚洲调教视频在线观看| 国产午夜精品全部视频在线播放 | 国产欧美一区二区精品仙草咪 | 国产一区二区三区的电影 | 亚洲精品久久7777| 国产精品中文在线| 欧美精品v国产精品v日韩精品| 亚洲一区二区三区国产| 亚洲伦理精品| 伊人成人在线| 欧美日韩免费在线观看| 久久久最新网址| 亚洲欧美经典视频| 亚洲精品偷拍| 亚洲国产精品一区二区尤物区| 国产日韩精品久久| 欧美日韩中文另类| 久久精品视频在线播放| 亚洲一区二区三区高清不卡| 亚洲精品黄网在线观看| 精品成人国产| 国产亚洲精品资源在线26u| 欧美色精品天天在线观看视频| 麻豆精品在线播放| 久久丁香综合五月国产三级网站| 亚洲午夜一区二区三区| 日韩视频中午一区| 亚洲国产天堂久久国产91| 国产精品久久久久高潮| 欧美日韩亚洲一区二区三区| 欧美好骚综合网| 老司机午夜精品视频| 久久成人免费视频| 亚洲中午字幕| 亚洲欧美在线一区二区| 亚洲免费在线观看视频| 亚洲一区二区精品视频| 亚洲视频精选在线| 一本久久精品一区二区| 亚洲美女淫视频| 日韩亚洲欧美高清| 亚洲国产精品女人久久久| 黄页网站一区| 狠狠色丁香婷综合久久| 国产欧美日韩综合| 国产亚洲欧洲997久久综合| 国产亚洲二区| 欧美性大战久久久久| 久久综合图片| 女女同性女同一区二区三区91| 免费试看一区| 欧美日韩国产小视频| 欧美日韩精品一区二区在线播放 | 国产精品家教| 国产精品乱码一区二区三区| 国产精品一卡二卡| 国产亚洲精品资源在线26u| 国产精品免费区二区三区观看| 国内久久精品| 亚洲欧洲精品一区二区| 99国产精品| 性色av一区二区三区| 久久久之久亚州精品露出| 欧美mv日韩mv国产网站| 欧美少妇一区| 很黄很黄激情成人| 尤物yw午夜国产精品视频| 亚洲小少妇裸体bbw| 久久国产欧美日韩精品| 欧美不卡三区| 国产精品久久久久秋霞鲁丝 | 欧美激情综合五月色丁香| 欧美日韩中文字幕在线| 国产一区二区无遮挡| 亚洲卡通欧美制服中文| 亚洲欧美精品suv| 农村妇女精品| 国产日本欧美视频| 亚洲伦理一区| 久久久久久日产精品| 欧美精品一区二| 国产一区二区看久久| 一本色道久久综合狠狠躁篇怎么玩| 午夜久久久久久久久久一区二区| 美女精品视频一区| 国产精品丝袜久久久久久app| 国产真实久久| 欧美一区国产二区| 欧美日韩精品系列| 黄色影院成人| 午夜一区二区三区不卡视频| 欧美成人午夜影院| 国产日产欧产精品推荐色 | 久久精品国产成人| 美女网站在线免费欧美精品| 国产精品久久网| 99精品视频一区| 欧美va日韩va| 国产真实精品久久二三区| 亚洲天堂第二页| 欧美屁股在线| 亚洲高清不卡| 久久免费午夜影院| 国产欧美一区二区精品性| 亚洲视频图片小说| 欧美顶级大胆免费视频| 伊人男人综合视频网| 欧美在线不卡| 国产精品一区二区你懂得| 一区二区三区蜜桃网| 欧美二区在线观看| 国产欧美精品在线观看| 国产乱码精品一区二区三区忘忧草 | 欧美日本高清视频| 亚洲欧洲免费视频| 欧美a级片网| 亚洲高清免费视频| 免费亚洲一区二区| 狠狠色狠狠色综合人人| 蜜臀av性久久久久蜜臀aⅴ| 1024国产精品|