国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女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怎么修改定
  • 短信驗證碼 豆包網頁版入口 破天一劍 目錄網 排行網

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

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

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    欧美精品久久96人妻无码| 久久久久成人精品| 黄色小视频大全| 日韩国产精品一区二区| 欧美xxxx14xxxxx性爽| 久久久精品网站| 91av福利视频| 国产精品一区电影| 麻豆一区区三区四区产品精品蜜桃| 日本电影一区二区三区| 国产精品久久成人免费观看| 精品国产欧美一区二区五十路| 91国产精品视频在线| 成人动漫在线视频| 国产乱人伦精品一区二区三区 | 日韩综合视频在线观看| 8050国产精品久久久久久| 成人免费aaa| 国产精品永久免费视频| 国产午夜福利视频在线观看| 欧美亚洲日本在线观看| 日韩欧美精品一区二区三区经典| 欧美一级视频一区二区| 日韩一区免费观看| 一区二区三区的久久的视频| 在线视频不卡国产| 欧美久久久精品| 99视频在线免费| 99视频免费观看蜜桃视频| 99视频日韩| 久久免费福利视频| 日韩一区二区三区在线播放| 国产黄色特级片| 久久国产精品久久精品国产| 日韩在线精品视频| 国产精品久久久久久久美男| 美女福利视频一区| 亚洲一区中文字幕| 日本精品一区二区三区不卡无字幕 | 国产精品美女久久久免费| 国产精品日日做人人爱| 国产精品女人网站| 九九精品视频在线| 亚洲欧洲日本国产| 日韩久久精品一区二区三区| 日本精品一区二区三区在线播放视频 | 91精品视频一区| 日韩最新av在线| 久久夜色精品国产欧美乱| 国产精品视频网| 久久国产精品久久国产精品| 午夜啪啪福利视频| 欧美亚洲视频一区| 国产精品一区二区三区免费| 久久久亚洲网站| 久久人人爽人人爽人人片亚洲| 精品中文字幕在线2019| 午夜精品美女久久久久av福利| 亚洲精品电影在线一区| 亚洲一区二区在| 欧美少妇在线观看| aaa免费在线观看| 久久精品在线播放| 在线一区日本视频| 日韩毛片在线免费看| 国产精品伊人日日| 久久一区免费| 国产精品久久久久国产a级| 欧美精品福利在线| 欧美在线一级视频| 99久久综合狠狠综合久久止| 色妞久久福利网| 亚洲欧美日韩不卡| 欧美日韩另类综合| 国产精成人品localhost| 国产精品国产一区二区| 午夜肉伦伦影院| 国产女主播一区二区三区| 久久久久久综合网天天| 久久久久久com| 黄色一区三区| 国产v亚洲v天堂无码| 中文字幕人妻熟女人妻洋洋| 欧美中文在线视频| av一区二区三区在线观看| 精品国偷自产在线| 国产日韩亚洲欧美在线| 日本精品久久久久中文字幕 | 午夜精品久久久久久久99热 | 国产在线观看91精品一区| 国产成人精品免高潮费视频| 中文字幕人妻熟女人妻洋洋| 日韩欧美亚洲精品| 国产精品18久久久久久麻辣 | 欧美成年人在线观看| 日韩精品xxxx| 成人免费a级片| 亚洲最大av网站| 国产女人18毛片| 国产精品久久91| 欧美 日韩 国产 激情| 国产成人亚洲精品| 无码人妻精品一区二区蜜桃网站| www.九色.com| 亚洲综合五月天| 国产这里只有精品| 欧美激情国产高清| 国产热re99久久6国产精品| 国产精品精品视频| 经典三级在线视频| 国产www精品| 日韩久久久久久久| 日韩在线免费av| 欧美无砖专区免费| 国产精品视频在线观看| 欧美日韩喷水| 国产精品久久久久久久久久免费| 激情小视频网站| 国产精品第一第二| 国产欧美日韩中文字幕在线| 欧美日韩成人在线播放| 黄色激情在线视频| 国产精品裸体一区二区三区| 精品少妇人欧美激情在线观看| 久久婷婷国产麻豆91天堂| 欧美高清视频一区 | 古典武侠综合av第一页| 欧美激情精品久久久久久蜜臀| 国产美女直播视频一区| 亚洲色成人www永久在线观看| 久久久一本二本三本| 欧美最猛性xxxxx亚洲精品| 国产精品免费久久久久影院| 国产一区二区三区小说| 国产精品久久久久久久久久免费| 精品一区二区三区国产| 欧美日韩高清区| 91久久精品视频| 日日摸日日碰夜夜爽无码| 久久久久久久久影视| 免费精品视频一区| 亚洲综合国产精品| 日韩在线精品一区| 国产精品亚洲自拍| 天堂√在线观看一区二区| 日韩中文字幕在线视频| 国产一二三区在线播放| 亚洲a在线播放| 国产精品十八以下禁看| 国产淫片免费看| 午夜精品视频在线观看一区二区| 久久久久久久久久亚洲| 日本精品久久久久影院| 国产精品老女人视频| 国产亚洲欧美在线视频| 性色av一区二区三区在线观看| 国产成人小视频在线观看| 国产女精品视频网站免费| 少妇人妻互换不带套| 国产精品久久一区| 68精品久久久久久欧美| 欧美专区在线播放| 性欧美长视频免费观看不卡| 国产精品久久一区主播| 91久久久久久国产精品| 欧美激情第六页| 亚洲精品在线免费看| 俺也去精品视频在线观看| 国产日韩在线一区二区三区| 欧美在线视频免费| 亚洲精品中文字幕乱码三区不卡| 国产成人手机视频| 91九色对白| 免费在线观看亚洲视频| 无码人妻精品一区二区三区99v| 国产精品免费一区| 久久精品国产99国产精品澳门| 俄罗斯精品一区二区| 黄色激情在线视频| 欧洲美女7788成人免费视频| 亚洲尤物视频网| 精品国产成人av在线免| 久久精品视频播放| 国产成人福利网站| 丰满人妻中伦妇伦精品app| 黄色a级片免费| 青青草原一区二区| 少妇特黄a一区二区三区| 欧美成人中文字幕在线| 超碰日本道色综合久久综合| 日韩视频在线免费| 国产成人一区二区三区免费看| 成人久久久久爱| 国产免费一区二区三区视频| 日韩免费在线视频| 亚洲欧美99| 一区二区三区国产福利| 国产精品福利网| 国产精品久久久久秋霞鲁丝| 国产成人生活片|