Question
How do I implement a Java method that counts the number of steps required to run another method? In a school project, I am told
How do I implement a Java method that counts the number of steps required to run another method?
In a school project, I am told to implement three sorting algorithms, bubble, selection and insertion; These algorithms will be used to sort a dictionary consinsting of 90,000 words. Than, to test efficiency, I am supposed to implement a getSteps() method that counts the number of steps required for each algorithm to sort a dictionary. I have already implemented the sorting algorithms and have been able to implement a method that measures the elapsed time required to perform each algorithm, however, that is not what the project prompt requests.
I have posted pictures of my sorting algorithms if that changes anything ... (ps, any advice on my sorting algorithms is appreciated!)
Help is appreciated!
40 41 42 43 public String] sortBubble) //Uses bubble sort algorithm to organize values within dictionary long start System.currentTimeMillisO; 45 46 47 48 String ] dict -loadDictionaryO; String temp = " ". for(int x = 0; x 0)i 49 50 51 52 53 54 y = 0; for(int yStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started