{"id":24021090,"url":"https://github.com/zipcodecore/dashamaps","last_synced_at":"2025-08-12T17:41:44.100Z","repository":{"id":45523438,"uuid":"201474116","full_name":"ZipCodeCore/DashaMaps","owner":"ZipCodeCore","description":"make a hash map, your future self will be grateful after that *fateful* interview","archived":false,"fork":false,"pushed_at":"2023-10-17T14:54:03.000Z","size":81,"stargazers_count":0,"open_issues_count":1,"forks_count":29,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T21:14:52.456Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZipCodeCore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-09T13:36:51.000Z","updated_at":"2023-10-17T14:54:08.000Z","dependencies_parsed_at":"2025-01-08T12:38:47.556Z","dependency_job_id":"36ff5562-7ab0-417c-a537-83742725f8eb","html_url":"https://github.com/ZipCodeCore/DashaMaps","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDashaMaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDashaMaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDashaMaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FDashaMaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZipCodeCore","download_url":"https://codeload.github.com/ZipCodeCore/DashaMaps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153949,"owners_count":21221330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-08T12:38:37.559Z","updated_at":"2025-04-15T21:14:56.869Z","avatar_url":"https://github.com/ZipCodeCore.png","language":"Java","readme":"# Dasha Map\nFork this repository and submit the URL of your fork via the Student Portal.\n\n* **Objective**\n    * To create a HashMap named `DashaMap` without using any class which extends, implements, or uses the built-in `java.util.Collection` interface.\n* **Purpose**\n    * To gain familiarity the Data Structures and `Collection` framework.\n* **Description**\n    * Create a `DashaMap` has a composite `MyLinkedList` of `MyNode` of `MyPair`s.\n\n\n\n\n![Image of Data Structure for HashMap](./DataStructureHashMap.png)\n\nWell, your first `hashing function` is this:\n\n```java\nprivate String HashFunctionOne(String input) {\n    if (input.length() \u003e 0) {\n        return String.toLowerCase(String.valueOf(input.charAt(0)));\n    }\n    return nil;\n}\n```\nAnd since you have a list of words, some of which have the same first letter (character),\nyou will have *hash collisions* when you insert a second word in the same bucket. That's why you have a\nlinked list which is attached to the end of the list when you insert/set a word.\n\nAnd your second hashing function is:\n\n```java\nprivate String HashFunctionTwo(String input) {\n    if (input.length() \u003e 0) {\n        return String.toLowerCase(String.valueOf(input.charAt(1)));\n    }\n    return nil;\n}\n```\n\nand your third hashing function is:\n\n```java\nprivate String HashFunctionThree(String input) {\n    if (input.length() \u003e 1) {\n        return String.toLowerCase(String.valueOf(input.charAt(0)+input.charAt(1)));\n    }\n    return nil;\n}\n```\n\nYou'll be writing three different classes, one for each hashing function. Call them `DashaMapOne,\nDashaMapTwo, \u0026 DashaMapThree`.\n\nBuild a test harness that can read in the word list and insert each word into each of the\nthree hash-maps.\n\nEach of the classes should implement this interface:\n\n```java\ninterface HashMapX {\n   \n   // fundamentals\n   public void set(String key, String value);\n   public String delete(String key);\n   public String get(String key);\n   public boolean isEmpty();\n   public long size();\n\n   // testing access\n   protected boolean bucketSize(String key); // used for tests\n}\n```\n\nWhen you create the constructor for each class, you need to create an array of `Node`\nobjects. Each `Node` should look like:\n\n```\nNode:\n    k: String\n    v: Integer\n    next: Node\n```\n\nThe hash-array needs to get initialized to 26 long of Node, with each value being 'a'..'z'.\n\nRead in the list of words in `wordlist.txt`. Each word is on it's own line, with a value,\nand as each word is read, insert it into each of the three hash-maps, using the word as the key,\nand integer value as the value.\n\nWhen you set a word/value pair: (this is pseudocode)\n\n```\n- set(key, value) {\n    key-hash = hash-function(key)\n    newval = new Node(key, value)\n    append-to(hash-array[key-hash], newval)\n}\n```\n\n`append-to` is a method that attaches the created node with the word as the key, the integer as the value,\nat the end of the linked list attached to the hash-array head list-pointer.\n\nWhen you get a word/value pair:\n\n```\n- value get(key) {\n    key-hash = hash-function(key)\n    newnode = find-in(hash-array[key-hash], key)\n    return newnode.v\n}\n```\n\n`find-in(array-slot, key-word)` returns the Node that contains the key-word in the `k` field.\n(you may want to just do a simple linear search to find the node that has the key in it).\n\nand the Hard One is `delete(key-word)`\n\nOy. that's enough.\n\n#### Nota Bene:\nIf you can figure out a way to make your implementation **GENERIC**, you get 2.75million extra points. That's enough to get the level 3 prize, or a very old, tattered, online copy of [Think Data Structures in Java](https://open.umn.edu/opentextbooks/textbooks/think-data-structures-algorithms-and-information-retrieval-in-java)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fdashamaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipcodecore%2Fdashamaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fdashamaps/lists"}