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爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          国产精品手机在线| 久久国产手机看片| 欧美日韩精选| 久久美女性网| 欧美一二三区在线观看| 亚洲第一页在线| 国产精品美女诱惑| 欧美伦理a级免费电影| 久久久精彩视频| 亚洲女爱视频在线| 在线一区二区三区四区五区| 国产深夜精品福利| 国产精品爱久久久久久久| 久久在线精品| 欧美freesex交免费视频| 午夜影院日韩| 亚洲欧美第一页| 亚洲综合色丁香婷婷六月图片| 99精品热视频只有精品10| 国产一区二区三区在线观看精品| 欧美日韩精品一区二区| 欧美日韩一区国产| 欧美日韩一二三区| 国产精品进线69影院| 国产精品丝袜xxxxxxx| 国产精品视频yy9099| 国产精品视频精品| 国产精品亚洲精品| 韩国免费一区| 亚洲国产视频a| 日韩午夜三级在线| 亚洲欧美日韩综合国产aⅴ| 欧美一区激情| 欧美久久久久久久久久| 国产精品视频导航| 伊人一区二区三区久久精品| 激情文学一区| 中文一区字幕| 欧美国产日韩一区二区三区| 欧美午夜无遮挡| 激情综合自拍| 亚洲欧美国产高清| 久久免费偷拍视频| 欧美精品色网| 国产精品素人视频| 美女精品一区| 欧美三区在线观看| 一级日韩一区在线观看| 久久久99久久精品女同性| 欧美日韩小视频| 亚洲精品1区| 久久久在线视频| 国产精品入口夜色视频大尺度| 制服丝袜亚洲播放| 欧美日韩中文| 一区二区三区www| 欧美精品情趣视频| 最新中文字幕一区二区三区| 久久另类ts人妖一区二区| 黄色精品一区| 男人的天堂成人在线| 亚洲激精日韩激精欧美精品| 欧美一区二区三区婷婷月色| 国产综合色一区二区三区| 久久精精品视频| 激情久久五月天| 欧美精品麻豆| 亚洲欧美日韩精品| 国产一级久久| 欧美精品亚洲| 久久久久久高潮国产精品视| 日韩亚洲欧美高清| 狠狠综合久久av一区二区老牛| 亚洲国产精品久久久久秋霞不卡 | 欧美激情综合色| 亚洲人成网在线播放| 欧美电影打屁股sp| 亚洲国产精品日韩| 国产精品久久久久高潮| 亚洲欧美bt| 国产日韩欧美一区二区| 欧美日韩免费观看一区=区三区| 中文在线资源观看网站视频免费不卡 | 国产真实乱偷精品视频免| 免费精品99久久国产综合精品| 一区二区高清视频| 亚洲欧洲三级电影| 国产精品国产三级国产aⅴ浪潮 | 国产在线高清精品| 久久久久久91香蕉国产| 欧美视频在线免费| 国产深夜精品福利| 在线一区欧美| 欧美自拍偷拍| 免费久久99精品国产| 欧美a级大片| 蜜月aⅴ免费一区二区三区 | 国产精品私拍pans大尺度在线 | 亚洲日本va在线观看| 亚洲精品日本| 亚洲国产精品一区二区久| 国产一区二区三区四区hd| 在线观看国产日韩| 一区二区三区视频在线看| 亚洲黄色精品| 亚洲一区美女视频在线观看免费| 亚洲一区二区免费视频| 欧美中文在线观看| 欧美中文字幕在线| 欧美成人在线影院| 国产欧美韩国高清| 亚洲精品视频二区| 欧美激情在线狂野欧美精品| 国产免费观看久久| 一区二区三区回区在观看免费视频| 欧美一级理论片| 国产精品高潮粉嫩av| 国产日韩欧美不卡| 亚洲私人影吧| 国产精品女主播| 最新中文字幕亚洲| 美女成人午夜| 国内精品视频在线观看| 午夜亚洲视频| 国产欧美日韩免费| 欧美一区二区三区电影在线观看| 欧美精品情趣视频| 日韩午夜电影在线观看| 免费一级欧美在线大片| 激情视频一区二区| 欧美在线观看一区二区三区| 国产主播一区二区| 免费高清在线视频一区·| 尤物yw午夜国产精品视频| 欧美gay视频激情| 一区二区三区视频在线播放| 欧美日韩美女| 亚洲欧美日韩精品久久| 国产一区二区三区四区老人| 久久免费黄色| aa级大片欧美| 国产一区二区视频在线观看 | 久久经典综合| 有码中文亚洲精品| 欧美精品色综合| 亚洲女性裸体视频| 亚洲激情另类| 国内精品久久久久久| 欧美午夜三级| 欧美激情四色 | 99成人在线| 在线日韩av永久免费观看| 欧美日韩中字| 免费看黄裸体一级大秀欧美| 午夜视频在线观看一区二区三区| 亚洲国产精品99久久久久久久久| 欧美四级电影网站| 欧美精品不卡| 欧美激情国产高清| 欧美大片第1页| 欧美~级网站不卡| 老鸭窝91久久精品色噜噜导演| 欧美一级片在线播放| 久久久福利视频| 久久久久久久久久看片| 欧美中文字幕第一页| 久久精品99国产精品| 久久国产精品毛片| 免费成人高清| 欧美日韩成人网| 欧美日韩直播| 国产精品国产三级国产aⅴ入口| 欧美日本在线| 国产精品一区二区在线观看网站| 国产精品区一区二区三区| 国产精品亚洲综合| 激情综合色综合久久综合| 亚洲国产精品成人精品| 亚洲视频电影在线| 久久久久一区| 欧美视频网址| 精品成人在线视频| 亚洲伊人色欲综合网| 久久综合成人精品亚洲另类欧美| 欧美成人精品在线视频| 国产精品精品视频| 亚洲国产一区在线| 翔田千里一区二区| 欧美日韩精品免费| 国产伊人精品| 在线视频一区二区| 欧美激情第9页| 一区二区三区在线观看欧美| 亚洲一区二区三区免费观看| 欧美—级a级欧美特级ar全黄| 国产日韩欧美在线播放不卡| 在线视频一区观看| 欧美国产高清| 亚洲青色在线| 欧美激情亚洲一区|