Skip to content

Commit

Permalink
Fix array indices starting from 2
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-naish committed Jan 19, 2025
1 parent bd035f5 commit afa551a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/algorithms/controllers/HashingInsertion.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// XXX could probably do with a restructure!
// Dynamic table size was first implemented in a rather inflexible way wrt what gets
// animated etc. The code has been hacked around to "fix" this but it could do with
// a re-think or at least a clean up!
// XXX could probably do with a restructure; certainly a clean up!
// Dynamic table size was first implemented in a rather inflexible way wrt what
// gets animated etc. The code has been hacked a lot to "fix" this and a
// bunch of other things...

import Array2DTracer from '../../components/DataStructures/Array/Array2DTracer';
import GraphTracer from '../../components/DataStructures/Graph/GraphTracer';
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataStructures/Array/Array1DRenderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ class Array1DRenderer extends Array2DRenderer {
style={{ display: 'flex', justifyContent: 'space-between' }}
>
{longestRow.map((_, i) => {
// if the graph instance is heapsort, then the array index starts from 1
i += 1;
// the array index starts from 1 in most algorithms
// 0 for straightRadixSort (wanted for count array)
if (algo !== "straightRadixSort") {
i += 1;
}
Expand Down

0 comments on commit afa551a

Please sign in to comment.