Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hashing_lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brady James Garvin
hashing_lab
Commits
f6e881d2
Commit
f6e881d2
authored
5 years ago
by
Brady James Garvin
Browse files
Options
Downloads
Patches
Plain Diff
Updated lab for 2019.
parent
580461a3
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
.eslintrc
+3
-0
3 additions, 0 deletions
.eslintrc
index.html
+2
-4
2 additions, 4 deletions
index.html
js/hash_table.js
+1
-3
1 addition, 3 deletions
js/hash_table.js
js/index.js
+2
-1
2 additions, 1 deletion
js/index.js
js/words.js
+1
-3
1 addition, 3 deletions
js/words.js
with
9 additions
and
11 deletions
.eslintrc
+
3
−
0
View file @
f6e881d2
...
...
@@ -4,6 +4,9 @@
"browser": true,
"jquery": true,
},
"parserOptions": {
"sourceType": "module",
},
"rules": {
"no-await-in-loop": "warn",
"no-compare-neg-zero": "warn",
...
...
This diff is collapsed.
Click to expand it.
index.html
+
2
−
4
View file @
f6e881d2
...
...
@@ -6,15 +6,13 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Hashing
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/index.css"
>
<script
defer=
"true"
src=
"libraries/jquery/jquery.min.js"
></script>
<script
defer=
"true"
type=
"module"
src=
"js/index.js"
></script>
</head>
<body>
<div
id=
"time"
></div>
<div
id=
"freeness"
></div>
<script
src=
"libraries/jquery/jquery.min.js"
></script>
<script
src=
"js/hash_table.js"
></script>
<script
src=
"js/words.js"
></script>
<script
src=
"js/index.js"
></script>
</body>
</html>
This diff is collapsed.
Click to expand it.
js/hash_table.js
+
1
−
3
View file @
f6e881d2
/* exported HashTable */
function
mod
(
value
,
modulus
)
{
const
result
=
value
%
modulus
;
return
result
<
0
?
result
+
modulus
:
result
;
...
...
@@ -38,7 +36,7 @@ function createBuckets(count) {
const
INITIAL_HASH_TABLE_CAPACITY
=
7
;
// eslint-disable-line no-magic-numbers
const
MAXIMUM_LOAD_FACTOR
=
2
/
3
;
// eslint-disable-line no-magic-numbers
class
HashTable
{
export
class
HashTable
{
constructor
(
hashFunction
)
{
this
.
_hashFunction
=
(
element
)
=>
mod
(
hashFunction
(
element
),
this
.
_buckets
.
length
);
this
.
_buckets
=
createBuckets
(
increaseToPseudoPrime
(
INITIAL_HASH_TABLE_CAPACITY
));
...
...
This diff is collapsed.
Click to expand it.
js/index.js
+
2
−
1
View file @
f6e881d2
/* globals HashTable DICTIONARY */
import
{
HashTable
}
from
'
./hash_table.js
'
;
import
{
DICTIONARY
}
from
'
./words.js
'
;
/* eslint-disable no-magic-numbers */
...
...
This diff is collapsed.
Click to expand it.
js/words.js
+
1
−
3
View file @
f6e881d2
/* exported DICTIONARY */
const DICTIONARY = [
export const DICTIONARY = [
"A",
"AA",
"AAA",
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment