Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!)

image text in transcribedimage text in transcribedimage text in transcribed

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 y

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions