首页 > 其他分享 >Hashtable  Complete the following

Hashtable  Complete the following

时间:2024-10-05 20:34:34浏览次数:6  
标签:function hash Complete Hashtable following word integrity

Assignment 3: Hashtable 
Assignment 3: Hashtable Due No Due Date 
Points 100 Submitting a file upload 
Start Assignment 
Language: Java or Python or C++ 
Task Description: Complete the following task. 


Task-1: Implement a Hash data structure from scratch. You can’t use built-in Hash or Dictionary APIs. You can use a built-in Array or List or your custom-built LinkedList. The Hash class must have the following functions and fields - HashTable: A fixed-size array or list. Depending on your hash function, this array or list can be 
one-dimensional or two-dimensional. hash(x): A hash function that converts a string x to an integer, i.e., index in the hashtable. You can implement any hash function described in the textbook. Your hash function must have a collision-resolution mechanism. insert(x): Insert string x to the HashTable in the index returned by hash(x). 
size(): Returns the size of the elements, i.e., the number of keys. Write sample test cases to validate your implementation. 


Task-2: Read and parse each word from the file pride-and-prejudice.txt 


(https://canvas.eee.uci.edu/courses/68108/files/28223336?wrap=1) 
(https://canvas.eee.uci.edu/courses/68108/files/28223336/download?download_frd=1) . Note that this file is very large; therefore, reading the text at once will crash your program. You should read the text line by line. To split a line into words, you can consider anything other than alpha-numeric (i.e. [a-zA-Z0-9]) characters as delimiters, for example, ‘\n’, ‘\t’, ‘,’, ‘.’ etc. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically 
using all the original letters exactly once. For example, `mango` and `gonma` are anagrams containing the same characters. Write a function that would find out how many unique anagram-root words are there in the novel.代 写Hashtable   Complete the following  An anagram-root word is a word that is derived by sorting the word by characters. For example, `mango`’s anagram root is `agmno`. To find the number of unique anagram roots, do the following steps.Assignment 3: Hashtable 2/3 SWE-240P-Rubric Step-1: While you parse each word from the file, sort the words by character. You can use any built-in sorting API. 
Step-2: Insert the sorted words in the hashtable you implemented above. If the word is already present in the hashtable, then skip it. 
Step-3: Once all the words have been sorted and inserted (or skipped), call the size() function of the Hash class. 
Note: You have to implement the classes from scratch. Please don’t engage in plagiarism in any manner. See UCI’s policy on academic integrity(https://aisc.uci.edu/students/academicintegrity/promote-integrity.php (https://aisc.uci.edu/students/academic-integrity/promote-integrity.php) ). 
Taking help from online materials is okay, but if you have taken any help online, please link the sources 
in the comment inside the code.Assignment 3: Hashtable 3/3 Total Points: 100 

标签:function,hash,Complete,Hashtable,following,word,integrity
From: https://www.cnblogs.com/comp9021/p/18447966

相关文章

  • 题解:UVA124 Following Orders
    考虑深搜和拓扑排序。从入度为零的节点开始,逐步添加到当前的排列结果中,并在每一步递减相邻节点的入度。如果某个节点的入度变为零,就递归地将其添加到当前排列中。一旦达到排列的叶节点,就存储起来,并按字典顺序排序。代码:#include<bits/stdc++.h>usingnamespacestd;voidread......
  • Delphi10.3关键字自动填充完成AutoComplete
    声明两个全局变量varaStringList:TStringList;//读取关键字aMemoInput:string;//当前已输入项procedureTSearchReplaceDemoForm.FormCreate(Sender:TObject);beginaStringList:=TStringList.Create;aStringList.LoadFromFile('keyWord.txt');//从文件......
  • 章14——Hashtable
    键和值为NULL时会抛出空指针异常。KEY重复且无NULL时同样会替换,和HashMap是一样的。按照2倍+1的规律去扩容与HASHMAP对比PROPERTIES,也是MAP接口的实现类,是Hashtable的子类.properties文件通常是用于数据库的配置文件,储存数据库的用户名密码等东西详细可见博客园博客:Java......
  • HashMap和HashTable
    HashMaphashMap基于哈希表,底层结果由数组实现,添加到map里的元素以key-value的形式存储在数组中,在数组中key-value已一个实体的形式存储, 也就是继承至map接口中的entry,下图是map源码enrty既然hashMap是基于哈希表,就会出现一个问题,就是哈希值重复,专业术语叫哈......
  • git error: Your local changes to the following files would be overwritten by mer
    3ad1444d^..73e10933为远程分支新提交,ac-dev分支落后远程分支4bd1444d^..83e10922个提交。现对ac-dev分支进行了修改,打算将ac-dev分支同步到4bd1444d最新提交,并保留ac-dev分支落后时的修改;ac-dev落后修改后没有提交或将其隐藏,直接cherry-pick遇到以下错误。gitcherry-p......
  • ResizeObserver loop completed with undelivered notifications. 报错
    js使用ResizeObserver时报错,代码实现逻辑如下:functionobserveVideoDom(width:number,height:number){constvideoDom=document.getElementById('videoDom')if(!videoDom)returnif(window.ResizeObserver){//ResizeObserver在iOS13.4及......
  • xtop:multi_driven_net与incomplete_timing_cell fail reason 分析
    我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?拾陆楼知识星球入口xtop做时序收敛时报告failreason&#x......
  • ZBlogPHP网站Leaked 1 hashtable iterators错误
    当遇到Z-BlogPHP报告“Leaked1hashtableiterators”错误时,这意味着在PHP脚本执行期间发生了内存泄漏问题,具体来说是在处理哈希表迭代时出现了问题。这个问题可能是由于PHP脚本中的编程错误导致的,或者是PHP自身的bug引起的。解决步骤1.更新PHP和Z-BlogPHP......
  • java中的Map系列的集合HashMap、HashTable、TreeMap以及Collections和Collection的区
    1.Map的特性特性:key键-value值身份证号--->人可以通过key获取到valueMap它的key是唯一的,Map中的key是无序的而且是不重复的value是可以重复的。Map集合的基本方法:Vput(Kkey,Vvalue)添加元素如果put的key存在那么会用新的value的值替换掉原有的value值key......
  • HashMap线程不安全|Hashtable|ConcurrentHashMap
    文章目录常见集合线程安全性HashMap为什么线程不安全?怎么保证HashMap线程安全HashtableConcurrentHashMap引入细粒度锁代码中分析总结小结常见集合线程安全性ArrayList、LinkedList、TreeSet、HashSet、HashMap、TreeMap等都是线程不安全的。HashTable是线程安......