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

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

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

時間:2024-12-09  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



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.


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

掃一掃在手機打開當前頁
  • 上一篇:COMP42215代做、代寫Python設計程序
  • 下一篇:CS-350代寫、C++編程語言代做
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務 管路
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真技術服務
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲勞振動
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲
    流體cfd仿真分析服務 7類仿真分析代做服務40個行業
    流體cfd仿真分析服務 7類仿真分析代做服務4
    超全面的拼多多電商運營技巧,多多開團助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團助手
    CAE有限元仿真分析團隊,2026仿真代做咨詢服務平臺
    CAE有限元仿真分析團隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗證碼 寵物飼養 十大衛浴品牌排行 suno 豆包網頁版入口 wps 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    国产精品福利无圣光在线一区| 不卡av日日日| 少妇久久久久久| 亚洲精品一区二区三区樱花| 国产在线精品自拍| 国产精品旅馆在线| 欧美精品与人动性物交免费看| 久久精品美女| 日韩av成人在线| 国产不卡一区二区视频| 日本亚洲精品在线观看| 久久精品一区二区三区不卡免费视频| 欧美日本高清一区| 免费观看国产成人| 国产精品久久久久7777| 黄色一级片av| 国产精品久久久久久久久久久久| 欧洲久久久久久| 久久精品国产一区二区电影| 欧美日韩激情四射| 国产精品三级网站| 黄色一级免费大片| 国产精品国产三级国产专区51| 国内一区在线| 精品自在线视频| 国产美女久久精品香蕉69| 欧美激情精品久久久久久蜜臀| 国产欧美综合精品一区二区| 色综合天天综合网国产成人网| www日韩在线观看| 视频一区亚洲| 九色91视频| 欧美精品久久久| 国产精品大片wwwwww| 国产色婷婷国产综合在线理论片a| 国产99在线|中文| 91av网站在线播放| 奇米影视首页 狠狠色丁香婷婷久久综合 | 亚洲欧洲精品一区| 97欧洲一区二区精品免费| 亚洲欧洲一二三| 久草免费福利在线| 精品一区二区三区免费毛片| 精品久久久久久无码中文野结衣| 粉嫩av一区二区三区天美传媒| 亚洲欧美丝袜| 久久久精品一区| 国产欧美一区二区白浆黑人| 国产999精品视频| 久久一区二区精品| 欧美亚洲另类久久综合| 欧美成人精品一区二区| 91传媒免费视频| 欧美亚洲视频一区| 精品不卡一区二区三区| 国产精品96久久久久久又黄又硬| 青青草成人网| 色综合视频网站| 久久av二区| 国产日韩中文在线| 日本欧美一二三区| 久久91亚洲精品中文字幕奶水| 国产精品99免视看9| 欧美一级大片视频| 中文视频一区视频二区视频三区| 久99久视频| 俄罗斯精品一区二区三区| 日韩欧美精品在线不卡| 久久久久久国产精品久久| 久久久久久久有限公司| 国产美女精品视频| 秋霞毛片久久久久久久久| 国产aⅴ精品一区二区三区黄| 久久精品国产精品亚洲精品色| 国产美女久久久| 欧美久久久久久一卡四| 亚洲a成v人在线观看| 国产精品乱码| 99热一区二区三区| 黄色影院一级片| 亚洲日本无吗高清不卡| 国产精品-区区久久久狼| 99高清视频有精品视频| 国外色69视频在线观看| 日韩av电影免费在线| 国产aaa一级片| 国产精品区一区二区三含羞草 | 91超碰中文字幕久久精品| 欧美丰满熟妇xxxxx| 亚洲精品一区二区三区樱花| 国产精品久久久久久久久久久久午夜片| 国产精品99久久久久久久| 国产在线999| 欧美亚洲丝袜| 日韩视频在线免费看| 午夜精品理论片| 国产aⅴ精品一区二区三区黄 | 日韩精品免费播放| 亚洲中文字幕无码不卡电影| 国产精品动漫网站| 久久人人爽人人爽人人片亚洲 | 久久久女女女女999久久| 国产伦精品一区二区| 欧美二区在线视频| 日韩美女在线观看| 亚洲黄色一区二区三区| 中文字幕人成一区| 美日韩精品免费视频| 国产精品第一第二| 国产精品爽爽ⅴa在线观看| 色999日韩欧美国产| 国产av熟女一区二区三区 | 九九精品在线播放| 久久久999国产| 日韩中文字幕网址| 久久久久久久久电影| 久久精品久久精品国产大片| 91精品国产综合久久久久久蜜臀| 成人免费在线小视频| 超碰97网站| 国产精品夜夜夜一区二区三区尤| 国产一区精品在线| 精品无人区一区二区三区| 精品99在线视频| 国内一区在线| 国产综合免费视频| 国产一区在线免费| 国产一二三四区在线观看| 欧美高清性xxxxhdvideosex| 欧美精品一区二区三区久久| 欧美日韩视频免费在线观看| 欧美日韩视频在线一区二区观看视频| 欧美一区激情视频在线观看| 区一区二区三区中文字幕| 欧美综合国产精品久久丁香| 欧美精品无码一区二区三区| 国内精品视频久久| 国产又粗又爽又黄的视频| 国产伦精品一区二区三区免| 超碰网在线观看| 久久免费福利视频| 国产成人生活片| 免费不卡在线观看av| 超碰91人人草人人干| 欧美日本在线视频中文字字幕| 在线视频不卡一区二区三区| 午夜在线视频免费观看| 日韩精品最新在线观看| 好吊色欧美一区二区三区 | 日韩在线观看免费| 国产精品免费久久久久久| 不卡av电影院| 亚洲精品电影在线一区| 日本高清视频精品| 美女亚洲精品| 99国产视频| 日韩亚洲精品电影| 国产精品久久久久久久久久99| 一区二区三区免费看| 日韩av一区二区三区在线| 欧美xxxx黑人又粗又长密月 | av在线不卡一区| 久久国产精品高清| 久久亚洲成人精品| 亚洲精品一区二区三区蜜桃久| 日韩精品最新在线观看| 国产在线一区二区三区播放| 91精品视频一区| 精品久久久91| 欧美日本啪啪无遮挡网站| 日本在线观看天堂男亚洲| 欧美激情亚洲天堂| www黄色在线| 久久久成人av| 亚洲一区中文字幕在线观看| 欧美日韩免费观看一区| 成人av免费在线看| 国产精品爽黄69| 亚洲a在线播放| 国产一区二区视频播放| 久久综合一区| 国产精品吊钟奶在线| 日本一区二区三区四区高清视频| 国产在线观看福利| 国产成人综合av| 久久夜色精品国产亚洲aⅴ| 日本一级黄视频| 成人h在线播放| 国产精品对白刺激久久久| 日本精品在线视频| 古典武侠综合av第一页| 国产精品区一区二区三含羞草| 污污污污污污www网站免费| 国产视频一视频二| 国产成人免费观看| 亚洲高清资源综合久久精品| 国产主播精品在线| 久久久91精品| 日韩精品一区二区在线视频| 99在线观看视频免费|