sort(0, count-1);
in
Programming Questions
•
2 years ago
In the visualizing data book by ben fry there is a update function in a class with the following line:
sort(0, count-1);
I don't get this line, i can show more code if you like but trust me there is no array called 0
So where is this line for?
(it's in the rankedlist.java, the code isn't in the book but the book tells you to download that file and add it to the skect, in case someone wanted to search in the book)
sort(0, count-1);
I don't get this line, i can show more code if you like but trust me there is no array called 0
So where is this line for?
(it's in the rankedlist.java, the code isn't in the book but the book tells you to download that file and add it to the skect, in case someone wanted to search in the book)
- // Sort the data and calculate min/max values
void update() {
// Set up an initial order to be sorted
order = new int[count];
for (int i = 0; i < count; i++) {
order[i] = i;
}
sort(0, count-1);
// Assign rankings based on the order after sorting
for (int i = 0; i < count; i++) {
rank[order[i]] = i;
}
// Calculate minimum and maximum values
minValue = PApplet.min(value);
maxValue = PApplet.max(value);
}
1
