#how can I measure time taken in (ms).
1 messages ยท Page 1 of 1 (latest)
โ This post has been reserved for your question.
Hey @outer quarry! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
I need to put the time taken in (ms)
What's that gotta do with the anime character
I dont know where to add
wrong pic
@grizzled niche ?
On phone
I will wait ?
No, I'll be on pc next on 23 March
I need to measure the time taken in (ms) all of the 5 sort
oh sad
no one can help me
because its very long
./run java
var startTime = System.currentTimeMillis();
try {
Thread.sleep(1000L);
} catch (Exception e) {}
var endTime = System.currentTimeMillis();
var elapsed = endTime - startTime;
System.out.println("wow that took " + elapsed + " ms!");
Here is your java(15.0.2) output @delicate vault
wow that took 1000 ms!
0
where will i put this ?
...
Try to understand it
starttime goes before long thing happening
endtime goes after long thing happening
all of the sort ?
printing how long it took goes after endtime
i don'tk now whaty our requirement is but i hope this gives you a guide as to how to time how long something took in java
I dont know where will I put that
i can't answer this because i don't know what you want
I need to measure the time taken in (ms) all of the 5 sort
I dont know this thats why
As u can see I have 5 sort
Not copy it
so before each sort make a start time
at the end of each sort make an end time and print end minus start
what's this then:
int numbers [] = {80, 72, 3, 83, 2, 11, 96, 13, 41, 49, 99, 97, 56, 31, 12, 64, 37, 42, 2, 11, 9, 96, 4, 91, 53, 82, 8, 8, 8, 99, 17, 34, 74, 1, 62, 4, 18, 41, 79, 92, 9, 47, 84, 45, 13, 12, 12, 81, 75, 86, 76, 26, 30, 3, 88, 77, 17, 36, 98, 93, 95, 22, 86, 27, 42, 0, 37, 26, 22, 56, 86, 99, 16, 63, 59, 65, 73, 43, 39, 25, 46, 1, 56, 65, 16, 55, 96, 21, 3, 58, 85, 88, 3, 4, 44, 84, 32, 22, 83, 54};
System.out.println("Original Array: " + Arrays.toString(numbers));
insertionSort(numbers);
selectionSort(numbers);
mergeSort(numbers);
quickSort(numbers);
heapSort(numbers);
}
numbers 1 - 100
program that sorts the assigned 100 numbers
@delicate vault hello >?
hi
insertionSort(numbers);
selectionSort(numbers);
mergeSort(numbers);
quickSort(numbers);
heapSort(numbers);
this is a list of all the operations
if i were to put a starttime before insertionsort and an endtime after insertionsort how would i do that
yes
ok
can u help me to fix it ?
sorry but i think i've given an extensive enough example above and will unfollow this thread
James please don't expect spoonfeeding
ok wait
making hard time with this sorry
can we remove the insertion sort first and insertion ?
Just leave it for now
The other 3 first sir @delicate vault
hello?
@delicate vault ?