加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

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

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++編程語言代做
  • 無相關信息
    合肥生活資訊

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

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

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

    国产成人精品福利| 午夜av成人| 日本电影一区二区| 欧美国产日本| av免费不卡国产观看| 久久影视一区| 日本在线成人| 影音先锋一区| 自拍偷自拍亚洲精品被多人伦好爽 | 欧美婷婷在线| julia中文字幕一区二区99在线| 美女高潮久久久| 97久久视频| 国产精品日本| 欧洲美女日日| 精品国产一区探花在线观看 | 欧美1区二区| 亚洲区小说区图片区qvod| 国产欧美日韩一级| 日韩一区二区在线免费| 噜噜爱69成人精品| 九九久久成人| 精品国产午夜肉伦伦影院| 亚洲激情播播| 欧美第一在线视频| 欧美日韩一区二区高清| 天堂久久一区| 欧亚一区二区| 亚洲天堂av影院| 丝袜美腿成人在线| 日韩视频三区| 香蕉精品视频在线观看| 久久综合99| 亚洲国产综合在线看不卡| 国产精品极品| 成人在线视频免费观看| 动漫av一区| www.成人网| 欧美三级视频| 国产精品三p一区二区| 日本久久伊人| av成人综合| 亚洲精品在线国产| 中文字幕一区二区三区日韩精品| 欧美极品中文字幕| 亚洲精品中文字幕99999| 国产一精品一av一免费爽爽| 欧美区亚洲区| 国产精品久久久久久久久久久久久久久 | 日韩午夜一区| 午夜影院欧美| 一区二区亚洲| 老司机一区二区三区| 午夜亚洲性色视频| 蜜桃免费网站一区二区三区| 欧美韩日一区| 女海盗2成人h版中文字幕| 日韩久久综合| 亚洲成人高清| 日本特黄久久久高潮| 永久亚洲成a人片777777| 国产精区一区二区| 日韩av一级片| 欧美巨大xxxx| 九九久久精品| 麻豆九一精品爱看视频在线观看免费| 美国毛片一区二区| 欧美三级网站| 美日韩一级片在线观看| 一区二区影院| 日韩电影一区二区三区四区| 超碰在线一区| 午夜欧美在线| 国产社区精品视频| 日本亚洲欧洲无免费码在线| 日本午夜一区二区| 日韩av黄色在线| 久久精品凹凸全集| 黄色精品网站| av在线视屏| 欧美一级一区| 欧美人与牛zoz0性行为| 欧美a级网站| 国产精品视频| 成人午夜毛片| 国产精品亚洲一区二区在线观看| 日本一区二区乱| 欧美色婷婷久久99精品红桃| 久久xxxx| 一区二区日本视频| 日韩欧美黄色| 欧美日韩一二三四| 水蜜桃精品av一区二区| 久久免费影院| 久久综合给合| 一区在线免费观看| 五月天亚洲色图| 日韩视频一二区| 精品久久97| 91精品国产乱码久久久久久久| 一区精品久久| 亚洲国产高清视频| 麻豆精品国产| 国产精品久久久久久影院8一贰佰| 成人午夜在线| 精品国产乱码久久久| 精品极品在线| 亚洲免费成人av在线| 91免费精品国偷自产在线在线| 日本三级亚洲精品| 亚洲尤物影院| 国产精品一二| 久久久久综合| 日韩不卡免费高清视频| 国产欧美精品| 欧美a级网站| 欧美成人一二区| 日本一不卡视频| 亚洲成人精选| 99热国内精品| 午夜日本精品| 日韩成人在线一区| 欧美视频导航| 国产高潮在线| 亚洲精品亚洲人成在线| 欧美在线网站| 麻豆久久一区二区| 精品久久97| 精品日本视频| 成人精品毛片| 中文字幕人成乱码在线观看| 亚洲区小说区图片区qvod| 国产日韩综合| 久久香蕉精品香蕉| 91精品99| 久久夜色电影| 欧美另类综合| 国语精品一区| 欧美日韩精品一本二本三本| 久久一综合视频| 欧美 日韩 国产一区二区在线视频 | 五月激情久久| 白嫩白嫩国产精品| 午夜精品成人av| 青青草综合网| 福利一区二区| 欧美一二区在线观看| 一区二区高清| **女人18毛片一区二区| 亚洲日本久久| 99综合视频| 欧美热在线视频精品999| 久久久久久久高潮| 欧美电影院免费观看| 一本色道久久综合| 国产一区二区三区四区二区 | 久久免费国产| 久久一区激情| 妖精视频成人观看www| 综合伊思人在钱三区| 成人一区不卡| 操欧美女人视频| 国产一区二区三区成人欧美日韩在线观看| 欧美一级全黄| 麻豆精品精品国产自在97香蕉| 亚洲精品a级片| 国产探花在线精品一区二区| www.色在线| 99精品在线观看| 99久久久国产| 亚洲精品永久免费视频| 日本久久成人网| 国产精品成人一区二区网站软件| 99国产精品| 精品一区91| 欧美在线1区| 蜜桃av综合| 久久99偷拍| 91精品福利观看| 欧洲av不卡| 日韩视频精品在线观看| 国产日韩中文在线中文字幕| 成人午夜毛片| 日韩精品一级中文字幕精品视频免费观看 | 亚洲精品网址| 亚洲日产av中文字幕| 九九久久国产| 免费观看在线色综合| 99久久影视| 亚洲国产最新| 欧美成人xxxx| 欧美好骚综合网| 激情视频一区二区三区| 日韩大胆成人| 久久精品麻豆| 色在线视频观看| 国产精品日韩| 亚洲午夜视频| swag国产精品一区二区| 亚洲最大黄网|