Question

1. what conditions does counting sort run in a linear line 2. which has the best...

1. what conditions does counting sort run in a linear line

2. which has the best running time. assume we sort n #s in range 0 to n^2 using radix sort(counting sort to sort each digit)

- all n numbers in decimal form(radix-10)

- all n numbers are represented in radix-n

Homework Answers

Answer #1

1. Time complexity of counting sort is O(n). Count sort runs on a condition that it will initially generates a new array based on the maximum element. Then by iterating through the entire array, it will count how many times each element occurs using for loop. Based on this condition counting sort run in a linear line.

2. Radix sort has a best running time when it comes to run in the range of 0 to n2 .

Radix sort is a specific type of sorting technique which starts with the top n-bit or n-digits and may sort those buckets using a radix sort etc, until every entry is sorted.

Counting sort is like using radix sort except you are using the whole value. Instead of recording each object, it has a bucket for each object and it just counts the number of occurrences. This works well when you have a limited number of possible keys and you have many duplicates.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
If you run summary() command on a result of linear model fitting returned by lm(), you...
If you run summary() command on a result of linear model fitting returned by lm(), you will see a column Pr(>t). You could guess that it is a result of some t-test. How does it apply here? So far we have seen t-tests in the settings of testing sample locations. The ingredients were: 1) null hypothesis: in earlier cases we looked into the null that stated that two samples came from the distribution(s) with the same mean(s); 2) test statistic:...
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number...
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number in A and an O(log n)-time computation for each odd number in A. What is the best-case running time of Algorithm X? What is the worst-case running time of Algorithm X? 2. Given an array, A, of n integers, give an O(n)-time algorithm that finds the longest subarray of A such that all the numbers in that subarray are in sorted order. Your algorithm...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import java.io.*; //This imports input and output (io) classes that we use 3 //to read and write to files. The * is the wildcard that will 4 //make all of the io classes available if I need them 5 //It saves me from having to import each io class separately. 6 /** 7 This program reads numbers from a file, calculates the 8 mean (average)...
a) Determine all x-values where the function has a horizontal tangent line. y=ln(1+sinx) b) The position...
a) Determine all x-values where the function has a horizontal tangent line. y=ln(1+sinx) b) The position of a particle is given by s(t)+2e^t/t . What is the particle's acceleration at t=1?  Round to 2 decimal places. c)Determine the limit using L'Hospital's rule. Before applying the rule, first verify that the function is a simplified indeterminate form. The rule may need to be used more than once. lim x->0 x^2/1-cosx
Use the following linear regression equation to answer the questions. x1 = 1.1 + 3.0x2 –...
Use the following linear regression equation to answer the questions. x1 = 1.1 + 3.0x2 – 8.4x3 + 2.3x4 (a) Which variable is the response variable? x3 x1      x2 x4 Which variables are the explanatory variables? (Select all that apply.) x1 x2 x3 x4 (b) Which number is the constant term? List the coefficients with their corresponding explanatory variables. constant = x2 coefficient= x3 coefficient= x4 coefficient= (c) If x2 = 4, x3 = 10, and x4 = 6, what...
Use the following linear regression equation to answer the questions. x1 = 1.5 + 3.5x2 –...
Use the following linear regression equation to answer the questions. x1 = 1.5 + 3.5x2 – 8.2x3 + 2.1x4 (a) Which variable is the response variable? A. x3 B. x1     C. x2 D. x4 (b) Which variables are the explanatory variables? (Select all that apply.) A. x4 B. x1 C. x3 D. x2 (c) Which number is the constant term? List the coefficients with their corresponding explanatory variables. constant ____________ x2 coefficient_________ x3 coefficient_________ x4 coefficient_________ (d) If x2 =...
Lab 6- Linear Kinetics 1. Place a pencil or pen on a flat surface. Using your...
Lab 6- Linear Kinetics 1. Place a pencil or pen on a flat surface. Using your finger, push on the side of the pencil in the middle. What happens? Now, reset the pencil and push again, using the same amount of force, but this time about midway between the center and the end of the pencil What happens this time? Considering the two trials you just completed, what do you think is the "take home message" about the application of...
Do the following problems. 1. Each of three barrels from a manufacturing line are classified as...
Do the following problems. 1. Each of three barrels from a manufacturing line are classified as either above (a) or below (b) the target weight. Provide the ordered sample space. 2. The heat on each of two soldered parts is measured and labeled as either low (l), medium (m), or high (h). State the number of elements in the ordered sample space. 3. Consider the set of Beatles songs with a primary writer as either Paul McCartney (P) or John...
1. Which of the following does a box plot not display? a. The range b. The...
1. Which of the following does a box plot not display? a. The range b. The interquartile range c. The lower quartile d. The mean 2. You have income data for your entire customer database. Some of your clients are far wealthier than others. Which of the following do outliers least affect? a. The range b. The mean c. The median d. The standard deviation 3. Some data were collected about consumer loyalty towards a (relatively) new brand of toilet...
Fill in the table below, using the information on this handout, based on what is best...
Fill in the table below, using the information on this handout, based on what is best for the client. Bill and Judy Dodge are married, and are each 35 years old. They have three children, with ages as of Dec. 31, 2019 as listed: Mary, age 5, Peter, age 2, and Lucy, age 4 months. Assume they did not itemize for their 2018 federal income tax return. The W2 table is for the 2019 income tax year. Assume tax laws...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • Doctor’s Order: Vancomycin 500mg tab i po q12h X 7 days Available: Vancomycin 500mg tablets What...
    asked 49 seconds ago
  • Calculate the ΔG∘rxn for the reaction using the following information. 4HNO3(g)+5N2H4(l)→7N2(g)+12H2O(l) ΔG∘f(HNO3(g)) = -73.5 kJ/mol; ΔG∘f(N2H4(l))...
    asked 1 minute ago
  • Question 03: Saturn Shoes (Pvt.) Ltd manufacture multi-style fashion boots for the residents of Missouri. Leather...
    asked 3 minutes ago
  • A highway with a design speed of 100 km/hr is designed with a sag curve connecting...
    asked 15 minutes ago
  • Shift Registers can be used for serial/parallel interface applications. True or false?
    asked 41 minutes ago
  • Scenario 1: To describe the instructors’ experience, the researcher records the year in which each instructor...
    asked 45 minutes ago
  • develop a flowchart or pseudocode to check the prime numbers 1- below 100 what to do...
    asked 45 minutes ago
  • Which of the following statements are true? I. The sampling distribution of ¯xx¯ has standard deviation...
    asked 45 minutes ago
  • Which of the following methods of reporting cash flows provided by operating activities does the Financial...
    asked 46 minutes ago
  • SITUATION 2: EFFECTIVE STRESS An engineer investigates a granular soil deposit, 4 meters thick, overlaying a...
    asked 1 hour ago
  • Suppose that R is a commutative ring and I is an ideal in R. Please prove...
    asked 1 hour ago
  • Shirley Trembley buys a house for $183,800. She puts 20% down and obtains a simple interest...
    asked 1 hour ago