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

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

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

時間:2024-12-09  來源:合肥網(wǎng)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++編程語言代做
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業(yè)/產(chǎn)品研發(fā)/客戶要求/設計優(yōu)化
    有限元分析 CAE仿真分析服務-企業(yè)/產(chǎn)品研發(fā)
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發(fā)動機性能
    挖掘機濾芯提升發(fā)動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機亮相AWE 復古美學與現(xiàn)代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網(wǎng) 排行網(wǎng)

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

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

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

          9000px;">

                色婷婷av一区二区| 56国语精品自产拍在线观看| 蜜臀国产一区二区三区在线播放| 亚洲人成网站精品片在线观看| 精品女同一区二区| 亚洲精品在线三区| 精品国产网站在线观看| 欧美大片免费久久精品三p| 日韩免费一区二区| 欧美sm美女调教| 337p粉嫩大胆噜噜噜噜噜91av| 欧美成人精品福利| 欧美精品一区二区三| 精品国内二区三区| 久久精品一区四区| 中文字幕制服丝袜成人av| 亚洲女子a中天字幕| 亚洲一区在线免费观看| 亚洲gay无套男同| 久久av中文字幕片| 成人免费视频播放| 色综合久久88色综合天天6| 欧美亚一区二区| 欧美蜜桃一区二区三区| 精品福利一区二区三区免费视频| 久久久一区二区| 自拍偷拍国产精品| 日本不卡1234视频| 成人黄色综合网站| 欧美三级视频在线播放| 欧美电影免费观看完整版| 欧美国产精品专区| 石原莉奈一区二区三区在线观看| 国产综合色视频| 91网站视频在线观看| 欧美一区二区三区日韩视频| 中文字幕成人网| 午夜精品在线视频一区| 国产激情一区二区三区| 在线观看91视频| 久久久久国产一区二区三区四区| 亚洲裸体在线观看| 久久国产人妖系列| 91麻豆swag| 国产婷婷一区二区| 首页亚洲欧美制服丝腿| 成人免费看片app下载| 91精品久久久久久蜜臀| 亚洲三级久久久| 国产一区视频在线看| 欧美女孩性生活视频| 国产精品你懂的在线欣赏| 免费欧美日韩国产三级电影| 91麻豆免费在线观看| 久久久久久久综合日本| 水蜜桃久久夜色精品一区的特点| 99久久精品国产网站| 久久久久久一二三区| 三级不卡在线观看| 欧美综合在线视频| 亚洲你懂的在线视频| 国产精品99久久久久久有的能看| 欧美一区二区三区免费| 亚洲午夜精品久久久久久久久| 99久久综合狠狠综合久久| 久久精品在线免费观看| 精品亚洲国内自在自线福利| 欧美精品一二三| 五月激情六月综合| 欧美日韩国产乱码电影| 亚洲国产综合91精品麻豆| 在线欧美日韩国产| 亚洲自拍偷拍网站| 欧美四级电影在线观看| 亚洲一级二级三级在线免费观看| 色天使久久综合网天天| 亚洲精品中文字幕乱码三区| 91尤物视频在线观看| 国产精品三级久久久久三级| 成年人国产精品| 亚洲欧美日韩一区| 色久综合一二码| 一区二区三区中文在线观看| 在线欧美一区二区| 亚洲成a人片在线不卡一二三区| 在线精品亚洲一区二区不卡| 亚洲一二三区视频在线观看| 在线综合亚洲欧美在线视频| 美女被吸乳得到大胸91| 久久免费视频一区| 成人动漫一区二区| 一二三四区精品视频| 337p亚洲精品色噜噜| 久久99精品一区二区三区| 久久久久久久久久久久久女国产乱| 国产一区二区福利视频| 国产精品九色蝌蚪自拍| 欧美午夜精品一区二区三区| 久久99日本精品| 日韩一区欧美一区| 欧美一区二区日韩一区二区| 国产在线精品一区二区夜色 | 最近中文字幕一区二区三区| 一本久久a久久免费精品不卡| 亚洲高清久久久| 日韩精品一区国产麻豆| 丁香亚洲综合激情啪啪综合| 一区二区三区四区在线免费观看| 欧美一区二区成人6969| 成人动漫av在线| 日韩国产一二三区| 中文字幕日韩精品一区| 欧美一区二区三区播放老司机| 成人免费高清在线| 日韩黄色小视频| 国产精品国产三级国产普通话三级 | 国产福利视频一区二区三区| 亚洲在线免费播放| 国产无一区二区| 欧美日韩精品三区| 97久久精品人人做人人爽| 日韩国产成人精品| 亚洲免费看黄网站| 久久久.com| 欧美电影一区二区三区| 91色porny蝌蚪| 国产伦理精品不卡| 美女久久久精品| 午夜精品一区二区三区免费视频| 中文字幕电影一区| 日韩精品一区二区三区视频| 在线精品观看国产| www.欧美亚洲| 高清日韩电视剧大全免费| 久久精品国产精品亚洲精品| 香蕉加勒比综合久久| 亚洲一线二线三线视频| 成人欧美一区二区三区| 国产日韩欧美电影| 久久精品亚洲一区二区三区浴池| 欧美一区二区久久久| 欧美精品自拍偷拍动漫精品| 日本高清视频一区二区| 99久久免费国产| 99国产精品视频免费观看| 99麻豆久久久国产精品免费优播| 国产1区2区3区精品美女| 成人伦理片在线| 国产高清亚洲一区| 东方aⅴ免费观看久久av| 国产不卡视频在线播放| 成人午夜精品一区二区三区| 国产不卡视频一区| 大白屁股一区二区视频| 成人免费黄色在线| 色综合久久六月婷婷中文字幕| 94色蜜桃网一区二区三区| 色噜噜久久综合| 欧美精品自拍偷拍动漫精品| 欧美一级片在线| 久久亚洲欧美国产精品乐播| 欧美激情一二三区| 亚洲精品国产一区二区精华液| 亚洲影院理伦片| 免费人成黄页网站在线一区二区| 久久av中文字幕片| 成人福利视频网站| 欧美午夜寂寞影院| 制服.丝袜.亚洲.另类.中文| 26uuu亚洲婷婷狠狠天堂| 国产人成亚洲第一网站在线播放| 国产精品国产三级国产有无不卡| 亚洲精品视频在线观看网站| 午夜精品福利视频网站| 激情综合网激情| 91在线视频观看| 欧美一区二区日韩一区二区| 日本一二三不卡| 亚洲小说欧美激情另类| 精品一区二区三区免费观看| 丰满少妇久久久久久久| 欧美日本免费一区二区三区| 久久五月婷婷丁香社区| 亚洲精品午夜久久久| 美国av一区二区| 99免费精品视频| 精品理论电影在线观看| 亚洲日穴在线视频| 精品一区二区三区在线观看 | 精品久久一区二区三区| 亚洲男人的天堂在线观看| 日韩成人免费电影| 不卡的av电影| 日韩一级在线观看| 亚洲日本一区二区三区| 国产一区二区三区日韩| 欧美三级日韩三级| 欧美极品另类videosde| 五月激情六月综合| 91国偷自产一区二区三区观看 |