Skip to content

Commit 14a0076

Browse files
JosephJoseph
Joseph
authored and
Joseph
committed
Made code more readable
1 parent d72df06 commit 14a0076

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

binsort lab starter code.zip_expanded/BinSort.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public Stack getSorted() {
2929
public void sort()
3030
{
3131

32-
int firstCheckIndex = wordSz - 1; //get the charAt value you should check first
32+
final int firstCheckIndex = wordSz - 1; //get the charAt value you should check first
3333
final int AlphaAsciiDiff = 97; //constant for converting between ASCII and the alphabet
3434
for (String str : theData) //start the sort by putting items from array to master stack and unsorted stack
3535
{
@@ -41,9 +41,9 @@ public void sort()
4141
{
4242
for (int i = 0; i < dataSz; i++) //put all words into their respective bins
4343
{
44-
String string = master.pop();
45-
char character = (string).charAt(charAtVal);
46-
bin[(int)(character) - AlphaAsciiDiff].push(string);
44+
String word = master.pop();
45+
char letter = (word).charAt(charAtVal);
46+
bin[(int)(letter) - AlphaAsciiDiff].push(word);
4747

4848
}
4949
for (int i = 25; i >= 0; i--) //loop through all the bins from right to left

0 commit comments

Comments
 (0)