国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

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

CSE2425代寫、C++編程語言代做
CSE2425代寫、C++編程語言代做

時(shí)間:2024-12-09  來源:合肥網(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ī)打開當(dāng)前頁
  • 上一篇:COMP42215代做、代寫Python設(shè)計(jì)程序
  • 下一篇:CS-350代寫、C++編程語言代做
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動(dòng)
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個(gè)行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手,多多出評(píng)軟件徽y1698861
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服務(wù)平臺(tái)
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 豆包網(wǎng)頁版入口 破天一劍 目錄網(wǎng) 排行網(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

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    伊人网在线免费| 色黄久久久久久| 熟女少妇精品一区二区| 国产日韩中文字幕在线| 91久久久在线| av一区二区在线看| 91精品免费看| 亚洲 欧美 综合 另类 中字| 亚洲中文字幕无码av永久| 狠狠久久综合婷婷不卡| 久久久一本二本三本| 国产精品高精视频免费| 欧美在线视频一区| 国产区一区二区三区| 精品乱子伦一区二区三区| 欧美影视一区二区| 亚洲精品国产系列| 99三级在线| 精品国产aⅴ麻豆| 国产欧美在线观看| 国产精品久久婷婷六月丁香| 欧美日韩二三区| 久久精品日韩| 性欧美大战久久久久久久| 国产精品10p综合二区| 欧美激情a∨在线视频播放| 国产男女免费视频| 国产精品国产福利国产秒拍| 亚洲一区二区三区在线免费观看 | 国产精品88a∨| 欧美精品国产精品日韩精品| 黄瓜视频免费观看在线观看www| 国产精品国色综合久久| 欧美日韩大片一区二区三区| 久草视频国产在线| 日韩国产欧美精品| 国产成人精品视频| 天堂资源在线亚洲资源| 国产日韩一区二区| 久久久国产视频| 欧美两根一起进3p做受视频| 国产成人在线亚洲欧美| 日批视频在线免费看| 131美女爱做视频| 天天干天天色天天爽| 久久久水蜜桃| 日本网站免费在线观看| 91精品国产91久久| 亚洲爆乳无码专区| 国产精品99久久久久久久| 视频一区在线免费观看| 国产激情在线看| 日本精品免费在线观看| 久久精品日产第一区二区三区| 日本精品久久久久中文字幕| 久草视频这里只有精品| 日本亚洲导航| 久久久久久久久中文字幕| 日韩精品另类天天更新| 久久精品久久久久久国产 免费| 欧美在线影院在线视频| 国产成人精品在线观看| 国内成人精品一区| 精品免费国产| 97成人在线视频| 日韩女优在线播放| 国产精品久久久久免费| 国产精品一久久香蕉国产线看观看| 中文字幕久精品免| 少妇精69xxtheporn| 国产综合久久久久久| 国产精品久久久久久久久久久新郎 | 少妇久久久久久| 男女午夜激情视频| 精品乱子伦一区二区三区| 国产精品午夜一区二区欲梦| 五月婷婷一区| www亚洲欧美| 国产综合免费视频| 亚洲高清乱码| 精品久久久av| 国产九色91| 日本a视频在线观看| 丝袜美腿亚洲一区二区| 国产一区二区中文字幕免费看| 欧美精品激情在线| 久久99精品久久久久子伦| 激情图片qvod| 五码日韩精品一区二区三区视频| www.亚洲免费视频| 国产女大学生av| 青青草久久网络| 欧美激情亚洲国产| 久久精品国产欧美亚洲人人爽| 国产免费黄色小视频| 日韩亚洲在线视频| 欧美激情a在线| 久久久久久国产免费| 国产在线精品一区| 日本精品视频一区| 欧美激情精品久久久久久久变态| 国产成人精品999| 日本不卡在线观看| 国产精品精品软件视频| www.av中文字幕| 欧美a在线视频| 无码播放一区二区三区| 国产精品国产精品国产专区蜜臀ah | 久久国产精品99久久久久久丝袜| 国产一区二区高清视频| 日本中文字幕久久看| 久久夜色精品国产亚洲aⅴ| 91精品国产色综合| 国产一区欧美二区三区| 热久久免费国产视频| 亚洲国产精品久久久久婷蜜芽| 国产精品久久久久91| 久久99国产精品| 成人av在线播放观看| 女同一区二区| 日韩免费一级视频| 亚洲女人毛片| 萌白酱国产一区二区| 久久色精品视频| 久久久久资源| www.浪潮av.com| 国产综合福利在线| 欧美专区日韩视频| 日韩在线第一区| 亚洲综合一区二区不卡| 九色成人免费视频| 久久综合亚洲社区| 国产精品乱码一区二区三区| 色噜噜狠狠狠综合曰曰曰| 国产成人激情小视频| 久久五月天婷婷| 国产精彩视频一区二区| 成人精品在线视频| 国产精品揄拍一区二区| 精品一区二区三区无码视频 | 国产精品久久国产精品99gif| 久久精品国产一区二区三区日韩| 91久久偷偷做嫩草影院| 97久久精品国产| 成人精品视频在线| 二级片在线观看| 不卡影院一区二区| 国产另类自拍| 99视频在线| 97精品在线观看| 97久久精品在线| 91精品视频在线免费观看| 99久久99| 粉嫩av一区二区三区免费观看| 国产女人18毛片水18精品| 国产精品一 二 三| 91久久久国产精品| 国产成人精品日本亚洲| 久久riav| 国产精品视频区1| 国产精品第100页| 精品国产一区二区三区麻豆免费观看完整版| 国产精品久久波多野结衣| 国产精品久久久久久久av大片 | 亚洲人成网站在线播放2019| 亚洲啪啪av| 欧美一区二区视频在线| 亚洲va韩国va欧美va精四季| 视频一区免费观看| 亚洲欧美丝袜| 日韩不卡av| 欧美 国产 日本| 国产日韩在线看| 97碰在线观看| 久久久久久久91| 精品中文字幕乱| 亚州国产精品久久久| 日韩精品一区二区三区色偷偷| 欧美精品成人网| 国产精品亚洲天堂| 久久久久久av无码免费网站下载| 久久久av网站| 国产精品人成电影在线观看| 欧美精品久久久久久久久久| 欧美一级淫片播放口| 欧美日韩一区二区视频在线观看| 国产专区在线视频| 91久久综合亚洲鲁鲁五月天| 日韩视频免费在线| 精品免费久久久久久久| 无码播放一区二区三区| 黄页免费在线观看视频| av免费中文字幕| 日韩三级成人av网| 正在播放国产精品| 欧美日本韩国在线| 97精品视频在线播放| 久久国产精品精品国产色婷婷| 国产精品电影在线观看| 视频一区二区三区在线观看|