Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34,380 changes: 17,190 additions & 17,190 deletions package-lock.json

Large diffs are not rendered by default.

Binary file added public/algo_buttons/ArrayList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 151 additions & 0 deletions src/AlgoList.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,154 @@ export const algoList = [
'LCS',
'Floyd',
];

export const algoFilter = [
{
id: 'ArrayList',
category: 'Lists',
},
{
id: 'LinkedList',
category: 'Lists',
},
{
id: 'DoublyLinkedList',
category: 'Lists',
},
{
id: 'CircularlyLinkedList',
category: 'Lists',
},
{
id: 'StackArray',
category: 'Linear Data Structures',
},
{
id: 'StackLL',
category: 'Linear Data Structures',
},
{
id: 'QueueArray',
category: 'Linear Data Structures',
},
{
id: 'QueueLL',
category: 'Linear Data Structures',
},
{
id: 'DequeArray',
category: 'Linear Data Structures',
},
{
id: 'DequeLL',
category: 'Linear Data Structures',
},
{
id: 'BST',
category: 'Trees',
},
{
id: 'Heap',
category: 'Trees',
},
{
id: 'AVL',
category: 'Trees',
},
{
id: 'BTree',
category: 'Trees',
},
{
id: 'SplayTree',
category: 'Trees',
},
{
id: 'SkipList',
category: 'SkipList',
},
{
id: 'OpenHash',
category: 'Hashmaps',
},
{
id: 'ClosedHash',
category: 'Hashmaps',
},
{
id: 'BubbleSort',
category: 'Sorting and Quick Select',
},
{
id: 'CocktailSort',
category: 'Sorting and Quick Select',
},
{
id: 'InsertionSort',
category: 'Sorting and Quick Select',
},
{
id: 'QuickSort',
category: 'Sorting and Quick Select',
},
{
id: 'QuickSelect',
category: 'Sorting and Quick Select',
},
{
id: 'MergeSort',
category: 'Sorting and Quick Select',
},
{
id: 'LSDRadix',
category: 'Sorting and Quick Select',
},
{
id: 'HeapSort',
category: 'Sorting and Quick Select',
},
{
id: 'BruteForce',
category: 'Pattern Matching',
},
{
id: 'BoyerMoore',
category: 'Pattern Matching',
},
{
id: 'KMP',
category: 'Pattern Matching',
},
{
id: 'RabinKarp',
category: 'Pattern Matching',
},
{
id: 'BFS',
category: 'Graph Algoritms',
},
{
id: 'DFS',
category: 'Graph Algoritms',
},
{
id: 'Dijkstra',
category: 'Graph Algoritms',
},
{
id: 'Prim',
category: 'Graph Algoritms',
},
{
id: 'Krusal',
category: 'Graph Algoritms',
},
{
id: 'LCS',
category: 'Dynamic Programming',
},
{
id: 'Floyd',
category: 'Dynamic Programming',
},
];
27 changes: 20 additions & 7 deletions src/algo/LinkedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export default class LinkedList extends Algorithm {
const index = parseInt(this.removeField.value);
if (index >= 0 && index < this.size) {
this.removeField.value = '';
this.implementAction(this.remove.bind(this), (index), false, false, true);
this.implementAction(this.remove.bind(this), index, false, false, true);
} else {
let errorMsg = 'Cannot remove from an empty list.';
if (this.size === 1) {
Expand Down Expand Up @@ -452,9 +452,13 @@ export default class LinkedList extends Algorithm {
}

if (runningBack) {
runningRemove ? this.highlight(6, 0, this.removeBackCodeID) : this.highlight(6, 0, this.addBackCodeID);
runningRemove
? this.highlight(6, 0, this.removeBackCodeID)
: this.highlight(6, 0, this.addBackCodeID);
} else {
runningRemove ? this.highlight(8, 0, this.removeIndexCodeID) : this.highlight(8, 0, this.addIndexCodeID);
runningRemove
? this.highlight(8, 0, this.removeIndexCodeID)
: this.highlight(8, 0, this.addIndexCodeID);
}
this.cmd(act.step);
}
Expand Down Expand Up @@ -723,7 +727,8 @@ export default class LinkedList extends Algorithm {
}

const runningRemoveFront = isRemoveFront || (isRemoveIndex && index === 0); // removefront is called directly or removeindex
const runningRemoveBack = isRemoveBack || (isRemoveIndex && index === this.size - 1 && !runningRemoveFront); // removeback is called directly or removeindex
const runningRemoveBack =
isRemoveBack || (isRemoveIndex && index === this.size - 1 && !runningRemoveFront); // removeback is called directly or removeindex
const runningRemoveIndexOnly = !runningRemoveFront && !runningRemoveBack; // removeindex is called directly

if (isRemoveIndex) {
Expand Down Expand Up @@ -847,8 +852,12 @@ export default class LinkedList extends Algorithm {
this.unhighlight(2, 0, this.removeFrontCodeID);
this.unhighlight(9, 0, this.removeBackCodeID);
this.unhighlight(11, 0, this.removeIndexCodeID);
runningRemoveIndexOnly ? this.highlight(12, 0, this.removeIndexCodeID) : runningRemoveBack ? this.highlight(10, 0, this.removeBackCodeID) : this.highlight(3, 0, this.removeFrontCodeID);

runningRemoveIndexOnly
? this.highlight(12, 0, this.removeIndexCodeID)
: runningRemoveBack
? this.highlight(10, 0, this.removeBackCodeID)
: this.highlight(3, 0, this.removeFrontCodeID);

this.cmd(act.step);
this.cmd(act.delete, this.linkedListElemID[index]);

Expand All @@ -868,7 +877,11 @@ export default class LinkedList extends Algorithm {
this.unhighlight(3, 0, this.removeFrontCodeID);
this.unhighlight(10, 0, this.removeBackCodeID);
this.unhighlight(12, 0, this.removeIndexCodeID);
runningRemoveIndexOnly ? this.highlight(13, 0, this.removeIndexCodeID) : runningRemoveBack ? this.highlight(11, 0, this.removeBackCodeID) : this.highlight(4, 0, this.removeFrontCodeID);
runningRemoveIndexOnly
? this.highlight(13, 0, this.removeIndexCodeID)
: runningRemoveBack
? this.highlight(11, 0, this.removeBackCodeID)
: this.highlight(4, 0, this.removeFrontCodeID);
this.cmd(act.step);

this.removeCode(this.removeFrontCodeID);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Header extends React.Component {
<BsFillSunFill
size={31}
onClick={toggleTheme}
color="#f9c333"
color="#e7c114"
className="rotate-effect"
/>
) : (
Expand Down
Loading