Read the instruction wrong for HDD, fixed
This commit is contained in:
parent
6b1af4cf0c
commit
662b668321
Binary file not shown.
|
@ -7,28 +7,10 @@ public class HistogramDataDisplay extends DataDisplay {
|
|||
@Override
|
||||
public void update() {
|
||||
System.out.println(getClass() + ": " + name);
|
||||
int[] sortedArray = super.getContent();
|
||||
boolean isSorted = false;
|
||||
while (!isSorted) {
|
||||
isSorted = true;
|
||||
for (int i = 0; i < sortedArray.length - 1; i++) {
|
||||
if (sortedArray[i] > sortedArray[i + 1]) {
|
||||
int temp = sortedArray[i];
|
||||
sortedArray[i] = sortedArray[i + 1];
|
||||
sortedArray[i + 1] = temp;
|
||||
isSorted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int lastVal = -1;
|
||||
for (int i : sortedArray) {
|
||||
if (i == lastVal)
|
||||
System.out.print("*");
|
||||
else {
|
||||
System.out.format("%s%d\t*", (lastVal == -1) ? "" : "\n", i);
|
||||
lastVal = i;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < super.getContent().length; i++)
|
||||
System.out.format("%s%d\t%s", (i == 0) ? "" : "\n", super.getContent()[i],
|
||||
"*".repeat(super.getContent()[i]));
|
||||
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue