Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C program without using selection likeiforswitch Problem: Data sets are often required to be in a sorted state to make certain types of analysis easier

C program without using selection likeiforswitch image text in transcribed
Problem: Data sets are often required to be in a sorted state to make certain types of analysis easier and a variety of sorting algorithms exist to assist scientists and engineers to complete this task. Sorting algorithms are primarily categorized by their run time complexity. This is given in the form of a formula based on the size of the data set (a positive integer n). This generates an estimation of how much "work" is necessary to complete the sort. The reason behind the different complexity of sorting algorithms is that some have more (or fewer) instructions ("work") which means that each attempt to sort takes a longer (or shorter) amount of time. Even among sorting algorithms of the same run time complexity there is another factor related to the time it takes to execute the types of individual instructions used and will be represented by a coefficient by which the formula is multiplied Given the data set size, the complexity category, and coefficient for two algorithms determine; (1) the run time for each algorithm, (2) identify the faster algorithm, and (3) the difference in time between the two selections. Example Execution #1: Notes on Example Execution #1: Algorithm Complexity Options . Both algorithms are from the same .The first algorithm has a smaller coefficient . The run time is a product of complexity complexity category (1) than the second. formula, the data set size, and the given 1. Linear time In] 2. Logarithmic time Inlog (n) ] 3. Exponential time [n 2] Enter the size of the data set to sort ->500 Select complexity option #1 Enter the coefficient of algorithm -> 10 Select complexity option #2-> 1 Enter the coefficient of algorithm #2-> 15 coefficient Time for algorithm 1 in seconds: 5000.000 Time for algorithm #2 in seconds : 7500.000 Faster algorithm #: 1 Time difference (seconds): 2500.000 Example Execution #2: -=-Algorithm Complexity Options 1. Linear time In] 2. Logarithmic time [nlog (n)) 3. Exponential time [n 21 Enter the size of the data set to sort- 100 select complexity option #1 1 Enter the coefficient of algorithm #1 "> 125 Select complexity option #2-> Enter the coefficient of algorithm #2 2 Time for algorithm #1 in seconds : 12500.000 Time for algorithm #2 in seconds : 20000.000 Faster algorithm #: 1 ime difference (seconds): 7500.000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions