Skip to content

Commit 32c96a5

Browse files
committed
Prettier
1 parent fae6858 commit 32c96a5

File tree

9 files changed

+65
-27
lines changed

9 files changed

+65
-27
lines changed

src/algo/BoyerMoore.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class BoyerMoore extends Algorithm {
119119
['abab in abacabacababa', 'abab in abacabacababa'],
120120
['lack in sphinxofblackquartz', 'lack in sphinxofblackquartz'],
121121
],
122-
'Example'
122+
'Example',
123123
);
124124
this.exampleDropdown.onclick = this.exampleCallback.bind(this);
125125
this.controls.push(this.exampleDropdown);
@@ -203,14 +203,14 @@ export default class BoyerMoore extends Algorithm {
203203
}
204204

205205
exampleCallback() {
206-
const selection = this.exampleDropdown.value
206+
const selection = this.exampleDropdown.value;
207207
if (!selection) {
208208
return;
209209
}
210210

211211
let textValue;
212212
let patternValue;
213-
213+
214214
if (selection === 'Random') {
215215
patternValue = this.generateRandomString(3, 'abc');
216216
textValue = this.generateRandomString(15, 'abc', patternValue);

src/algo/BruteForce.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import Algorithm, {
2828
addControlToAlgorithmBar,
2929
addDivisorToAlgorithmBar,
3030
addDropDownGroupToAlgorithmBar,
31-
addLabelToAlgorithmBar
31+
addLabelToAlgorithmBar,
3232
} from './Algorithm.js';
3333
import { act } from '../anim/AnimationMain';
3434
import pseudocodeText from '../pseudocode.json';
@@ -102,7 +102,7 @@ export default class BruteForce extends Algorithm {
102102
['abab in abacabacababa', 'abab in abacabacababa'],
103103
['lack in sphinxofblackquartz', 'lack in sphinxofblackquartz'],
104104
],
105-
'Example'
105+
'Example',
106106
);
107107
this.exampleDropdown.onclick = this.exampleCallback.bind(this);
108108
this.controls.push(this.exampleDropdown);
@@ -152,14 +152,14 @@ export default class BruteForce extends Algorithm {
152152
}
153153

154154
exampleCallback() {
155-
const selection = this.exampleDropdown.value
155+
const selection = this.exampleDropdown.value;
156156
if (!selection) {
157157
return;
158158
}
159159

160160
let textValue;
161161
let patternValue;
162-
162+
163163
if (selection === 'Random') {
164164
patternValue = this.generateRandomString(3, 'abc');
165165
textValue = this.generateRandomString(15, 'abc', patternValue);

src/algo/KMP.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default class KMP extends Algorithm {
111111
['abab in abacabacababa', 'abab in abacabacababa'],
112112
['lack in sphinxofblackquartz', 'lack in sphinxofblackquartz'],
113113
],
114-
'Example'
114+
'Example',
115115
);
116116
this.exampleDropdown.onclick = this.exampleCallback.bind(this);
117117
this.controls.push(this.exampleDropdown);
@@ -171,14 +171,14 @@ export default class KMP extends Algorithm {
171171
}
172172

173173
exampleCallback() {
174-
const selection = this.exampleDropdown.value
174+
const selection = this.exampleDropdown.value;
175175
if (!selection) {
176176
return;
177177
}
178178

179179
let textValue;
180180
let patternValue;
181-
181+
182182
if (selection === 'Random') {
183183
patternValue = this.generateRandomString(3, 'abc');
184184
textValue = this.generateRandomString(15, 'abc', patternValue);

src/algo/LinkedList.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import Algorithm, {
3232
addLabelToAlgorithmBar,
3333
} from './Algorithm';
3434
import { act } from '../anim/AnimationMain';
35-
import pseudocodeText from '../pseudocode.json'
35+
import pseudocodeText from '../pseudocode.json';
3636

3737
const INFO_MSG_X = 25;
3838
const INFO_MSG_Y = 15;
@@ -298,7 +298,7 @@ export default class LinkedList extends Algorithm {
298298

299299
// Pseudocode
300300
this.pseudocode = pseudocodeText.SinglyLinkedList;
301-
301+
302302
this.resetIndex = this.nextIndex;
303303

304304
this.animationManager.startNewAnimation(this.commands);
@@ -441,7 +441,7 @@ export default class LinkedList extends Algorithm {
441441
this.unhighlight(6, 0, this.addBackCodeID);
442442
this.unhighlight(8, 0, this.addIndexCodeID);
443443
this.cmd(act.step);
444-
444+
445445
this.cmd(act.setHighlight, this.linkedListElemID[i], 1);
446446
if (i > 0) {
447447
this.cmd(act.setHighlight, this.linkedListElemID[i - 1], 0);
@@ -493,7 +493,7 @@ export default class LinkedList extends Algorithm {
493493
const runningAddFront = isAddFront || (isAddIndex && index === 0); // addfront is called directly or addindex
494494
const runningAddBack = isAddBack || (isAddIndex && index === this.size && !runningAddFront); // addback is called directly or addindex
495495
const runningAddIndexOnly = !runningAddFront && !runningAddBack; // addindex is called directly
496-
496+
497497
if (isAddIndex) {
498498
if (runningAddFront) {
499499
this.cmd(act.step);
@@ -522,7 +522,7 @@ export default class LinkedList extends Algorithm {
522522
}
523523

524524
this.cmd(act.step);
525-
525+
526526
if (runningAddBack && this.size > 0) {
527527
this.unhighlight(1, 0, this.addBackCodeID);
528528
this.highlight(3, 0, this.addBackCodeID);
@@ -659,7 +659,7 @@ export default class LinkedList extends Algorithm {
659659
this.unhighlight(5, 0, this.addFrontCodeID);
660660
this.unhighlight(6, 0, this.addFrontCodeID);
661661
this.highlight(8, 0, this.addFrontCodeID);
662-
} else if (runningAddBack) {
662+
} else if (runningAddBack) {
663663
this.unhighlight(1, 0, this.addBackCodeID);
664664
this.unhighlight(2, 0, this.addBackCodeID);
665665
this.unhighlight(3, 0, this.addBackCodeID);

src/algo/RabinKarp.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default class RabinKarp extends Algorithm {
125125
['abab in abacabacababa', 'abab in abacabacababa'],
126126
['lack in sphinxofblackquartz', 'lack in sphinxofblackquartz'],
127127
],
128-
'Example'
128+
'Example',
129129
);
130130
this.exampleDropdown.onclick = this.exampleCallback.bind(this);
131131
this.controls.push(this.exampleDropdown);
@@ -197,14 +197,14 @@ export default class RabinKarp extends Algorithm {
197197
}
198198

199199
exampleCallback() {
200-
const selection = this.exampleDropdown.value
200+
const selection = this.exampleDropdown.value;
201201
if (!selection) {
202202
return;
203203
}
204204

205205
let textValue;
206206
let patternValue;
207-
207+
208208
if (selection === 'Random') {
209209
patternValue = this.generateRandomString(3, 'abc');
210210
textValue = this.generateRandomString(15, 'abc', patternValue);

src/css/AlgoScreen.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,29 @@ em {
283283
width: 15px;
284284
}
285285

286+
.modal-content button {
287+
background: var(--button);
288+
border: var(--border) 2px solid;
289+
border-radius: 6px;
290+
padding: 4px 10px;
291+
color: var(--primary);
292+
margin: 6px;
293+
cursor: pointer;
294+
font-size: 13px;
295+
font-weight: 550;
296+
}
297+
298+
.modal-content .button-container {
299+
display: flex;
300+
justify-content: right;
301+
margin-top: -1%;
302+
margin-bottom: -5%;
303+
}
304+
305+
.modal-content button:hover {
306+
filter: var(--filter);
307+
}
308+
286309
.VisualizationMainPage input[type='button'] {
287310
background: var(--button);
288311
border: var(--border) 2px solid;

src/modals/BigOModals.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,23 @@ const ToggleBlurCell = ({ text }) => {
5353
);
5454
};
5555

56+
// Function to unblur all cells with the blur class
57+
function unblurAll() {
58+
const blurredElements = document.querySelectorAll('.blur');
59+
blurredElements.forEach(element => {
60+
element.classList.remove('blur');
61+
});
62+
}
63+
5664
const Modals = page => {
57-
return renderRows(timeComplexities[page]);
65+
return (
66+
<div>
67+
<div class="button-container">
68+
<button onClick={unblurAll}>Reveal All Big-O</button>
69+
</div>
70+
{renderRows(timeComplexities[page])}
71+
</div>
72+
);
5873
};
5974

6075
export default Modals;

src/pseudocode.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
["end procedure"]
246246
]
247247
},
248-
"removeIndex":{
248+
"removeIndex": {
249249
"code": [
250250
["procedure removeFromIndex(index)"],
251251
[" if index == 0"],
@@ -280,7 +280,7 @@
280280
[" decrement size"],
281281
[" return temp"],
282282
[" end if"],
283-
["end procedure"]
283+
["end procedure"]
284284
]
285285
}
286286
},

src/time_complexities.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
},
4343
"worst": {
4444
"big_o": "O(n)",
45-
"explanation": "Resizing the array and shifting every element are each $O(n)$."
45+
"explanation": "Resizing the array and shifting $n$ elements are each $O(n)$."
4646
}
4747
},
4848
"Remove from Front": {
4949
"all cases": {
5050
"big_o": "O(n)",
51-
"explanation": "You always have to shift every element to the left."
51+
"explanation": "You always have to shift $n$ elements to the left."
5252
}
5353
},
5454
"Remove from Back": {
@@ -60,15 +60,15 @@
6060
"Remove at Index": {
6161
"best": {
6262
"big_o": "O(1)",
63-
"explanation": "If you remove the last element, you don't have to shift anything."
63+
"explanation": "If you remove the last element, you don't have to shift any elements."
6464
},
6565
"average": {
6666
"big_o": "O(n)",
67-
"explanation": "You have to shift elements after the index to the left."
67+
"explanation": "You have to shift all elements after the index to the left."
6868
},
6969
"worst": {
7070
"big_o": "O(n)",
71-
"explanation": "You have to shift every element to the left."
71+
"explanation": "If you remove the first element, You have to shift $n$ elements to the left."
7272
}
7373
}
7474
},

0 commit comments

Comments
 (0)