Skip to content

Commit af426ad

Browse files
committed
= vs == vs <- clean up
1 parent 33d87bf commit af426ad

File tree

9 files changed

+26
-28
lines changed

9 files changed

+26
-28
lines changed

src/algorithms/controllers/msort_arr_td.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Uses simple stack display like DFSrec; stack vanishes inside
66
// merge+copy because screen real-estate is limited and details of merge
77
// are independent of stack details anyway (may cause some surprise
8-
// though)
8+
// though) XXX would be nice to add QS/REX style stack display instead
99

1010
import { msort_arr_td } from '../explanations';
1111
import {colors} from '../../components/DataStructures/colors';
@@ -268,9 +268,9 @@ export function run_msort() {
268268

269269
const refresh_stack = (vis, cur_real_stack, cur_finished_stack_frames, cur_i, cur_j, cur_pivot_index, cur_depth) => {
270270

271-
// XXX
271+
// XXX left over from quicksort...
272272
// We can't render the -1 index in the array
273-
// For now we display i==0/j==0 at left of array if appropriate
273+
// For now we display i=0/j=0 at left of array if appropriate
274274
let cur_i_too_low;
275275
let cur_j_too_low;
276276
if (cur_i === -1) {

src/algorithms/controllers/quickSort_shared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ cur_i, cur_j, cur_pivot_index, cur_left, cur_right, cur_depth) {
281281
const refresh_stack = (vis, cur_real_stack, cur_finished_stack_frames, cur_i, cur_j, cur_pivot_index, cur_left, cur_right, cur_depth) => {
282282

283283
// We can't render the -1 index in the array
284-
// For now we display i==0/j==0 at left of array if appropriate
284+
// For now we display i=0/j=0 at left of array if appropriate
285285
let cur_i_too_low;
286286
let cur_j_too_low;
287287
if (cur_i === -1) {

src/algorithms/pseudocode/DFSrec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ DFS1(G, n, p) // Search from node n using parent node p. This visits all \\B dfs
6363
// nodes connected to n, ignoring nodes with parents already
6464
// assigned (as if these nodes have been removed from G).
6565
\\In{
66-
if Parent[n] == null // Ignore n if Parent[n] has been assigned \\B check_parent
66+
if Parent[n] = null // Ignore n if Parent[n] has been assigned \\B check_parent
6767
\\In{
6868
Parent[n] <- p \\B assign_parent
6969
\\Expl{ Node n is now finalised.

src/algorithms/pseudocode/HashingInsertion.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import parse from '../../pseudocode/parse';
22

33

4-
// XXX Best skip NullTable and HashInit function completely - just start
4+
// We now skip NullTable and HashInit function completely - just start
55
// animation with initialised table
6-
// XXX: if dynamic tables are not implemented, both CheckTableFullness
7-
// and CheckTableFullnessDel should be removed (if they are added the
8-
// bookmarks withing them should be different, and maybe
9-
// explanations)
10-
// NOTE: code now no longer explicitly keeps track of number of
11-
// insertions and CheckTableFullness is modified so some bookmarks (eg,
12-
// 4, 19, 20) no longer exist and controller code will have to change
6+
// If dynamic tables are not implemented, both CheckTableFullness
7+
// and CheckTableFullnessDel should be removed.
8+
// Currently dynamic tables are supported for open addressing but not
9+
// chaining. The latter still has "Check how full the table is" that
10+
// doesn't expand but has an explanation. XXX could be added some time.
1311

1412
const main = `
1513
@@ -135,7 +133,7 @@ const main = `
135133
there will be no duplicate elements.
136134
\\Expl}
137135
\\In{
138-
OldT = T; // save T so we can extract the keys
136+
OldT <- T; // save T so we can extract the keys
139137
T <- new empty table \\B 30
140138
\\Expl{ Without deleted elements, it is best for
141139
the table size to approximately double. If there are many deleted slots

src/algorithms/pseudocode/TTFTreeSearch.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ export default parse(`
3131
// Return node t if it contains key k
3232
if t is a two-node \\B if t is a two-node: Return_if_key_in_node
3333
\\In{
34-
if t.key1 == k return t \\B if t.key1 == k return t
34+
if t.key1 = k return t \\B if t.key1 == k return t
3535
\\In}
3636
else if t is a three-node \\B if t is a three-node: Return_if_key_in_node
3737
\\In{
38-
if t.key1 == k or t.key2 == k return t \\B if t.key1 == k or t.key2 == k return t
38+
if t.key1 = k or t.key2 = k return t \\B if t.key1 == k or t.key2 == k return t
3939
\\In}
4040
else // t is a four-node \\B else: Return_if_key_in_node
4141
\\In{
42-
if t.key1 == k or t.key2 == k or t.key3 == k return t \\B if t.key1 == k or t.key2 == k or t.key3 == k return t
42+
if t.key1 = k or t.key2 = k or t.key3 = k return t \\B if t.key1 == k or t.key2 == k or t.key3 == k return t
4343
\\In}
4444
\\Code}
4545
@@ -96,4 +96,4 @@ export default parse(`
9696
\\In}
9797
\\Code}
9898
99-
`);
99+
`);

src/algorithms/pseudocode/msort_list_td.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ CopySmaller
138138
139139
\\Code{
140140
CopyRest
141-
if L == Null
141+
if L = Null
142142
\\In{
143143
tail(E) <- R // append extra R elements to M \\B appendR
144144
\\In}

src/algorithms/pseudocode/msort_lista_td.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ scan
4747
Mid <- L \\B Mid
4848
\\Expl{ Start at first element of L
4949
\\Expl}
50-
for i = 1 to len/2 - 1 // while not at middle
50+
for i <- 1 to len/2 - 1 // while not at middle
5151
\\In{
5252
Mid <- Mid.tail \\B MidNext
5353
\\Expl{ Skip to next element

src/algorithms/pseudocode/straightRadixSort.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ for num in A \\B 13
9898
9999
\\Code{
100100
CumSum
101-
for i = 1 to maximum digit value \\B 14
101+
for i <- 1 to maximum digit value \\B 14
102102
\\Expl{ We must scan left to right. The count for digit 0 remains
103103
unchanged.
104104
\\Expl}
105105
\\In{
106-
Count[i] = Count[i-1] + Count[i] \\B 15
106+
Count[i] <- Count[i-1] + Count[i] \\B 15
107107
\\In}
108108
\\Code}
109109
@@ -127,8 +127,8 @@ for each num in A in reverse order \\B 8
127127
highlighted, and the digit value 0-3 (maybe the latter can be done
128128
by just highlighting B[digit] instead).
129129
\\Note}
130-
Count[digit] = Count[digit]-1 \\B 18
131-
B[Count[digit]] = num \\B 9
130+
Count[digit] <- Count[digit] - 1 \\B 18
131+
B[Count[digit]] <- num \\B 9
132132
\\In}
133133
\\Code}
134134

src/algorithms/pseudocode/unionFindUnion.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ Union(n, m) // merge/union the subsets containing n and m, respectively \\B Unio
8787
\\In{
8888
n <- Find(n) \\B n <- Find(n)
8989
m <- Find(m) \\B m <- Find(m)
90-
if n == m // in same subset already - nothing to do \\B if n == m
90+
if n = m // in same subset already - nothing to do \\B if n == m
9191
\\In{
9292
return \\B return
9393
\\In}
9494
swap n and m if needed to ensure m is the "taller" subtree \\Ref Maybe_swap
95-
parent[n] = m // add the shorter subtree (n) to the taller one (m) \\B parent[n] = m
95+
parent[n] <- m // add the shorter subtree (n) to the taller one (m) \\B parent[n] = m
9696
\\Expl{ This sometimes increases the height of the resulting tree but
9797
if we added the taller to the shorter the height would always
9898
increase.
@@ -147,7 +147,7 @@ still use n
147147
148148
\\Code{
149149
Adjust_rank
150-
if rank[n] == rank[m] \\B if rank[n] == rank[m]
150+
if rank[n] = rank[m] \\B if rank[n] == rank[m]
151151
\\Expl{ If we are adding a strictly shorter subtree to m the height
152152
doesn't change, but if the heights were equal the new height
153153
\\Expl}
@@ -163,7 +163,7 @@ Initialise
163163
\\Note{ No need to animate this?? We just have this as the initial
164164
state of the animation.
165165
\\Note}
166-
parent[i] = i and rank[i] = 0 for all elements i in the set \\B parent[i] = i and rank[i] = 0 for all elements i in the set
166+
parent[i] <- i and rank[i] <- 0 for all elements i in the set \\B parent[i] = i and rank[i] = 0 for all elements i in the set
167167
\\Expl{ Initially, each element i is in its own singleton subset. If
168168
the array has free space, extra elements can be added and
169169
initialised in the same way.

0 commit comments

Comments
 (0)