1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AVprozaik [17]
3 years ago
8

Say you have a random, unordered list containing 4096 four-digit numbers. Describe the most efficient way to: sort the list and

then search for 100 elements within the list, and analyze the expected run time for this specific list's sorting and searching.
Engineering
1 answer:
Debora [2.8K]3 years ago
6 0

Answer:

Answer explained below

Explanation:

It is given that numbers are four-digit so maximum value of a number in this list could be 9999.

So we need to sort a list of integers, where each integer lies between [0,9999].

For these given constraints we can use counting sort which will run in linear time i.e. O(n).

--------------------------------------------------------------------------------

Psuedo Code:

countSort(int numList[]) {

int count[10000];

count[i] = 0; for all i;

for(int num in numList){

count[num]+= 1;

}

return count;

}

--------------------------------------------------------------------------------

Searching in this count array will be just O(1).

E.g. Lets say we want to search if 3 was present in the original list.

Case 1: it was present in the original list:

Then the count[3] would have been incremented by our sorting algorithm. so in case element exists then count value of that element will be greater than 0.

Case 2: it was not present:

In this case count[3] will remain at 0. so in case element does not exist then count of that element will be 0.

So to search for an element, say x, we just need to check if count[x]>0.

So search is O(1).

Run times:

Sorting: O(n)

Search: O(1)

You might be interested in
What is the metal removal rate when a 2 in-diameter hole 3.5 in deep is drilled in 1020 steel at cutting speed of 120 fpm with a
Studentka2010 [4]

Answer:

a) the metal removal rate is 14.4 in³/min

b) the cutting time is 0.98 min

Explanation:

Given the data from the question

first we find the rpm for the spindle of the drilling tool, using the equation

Ns = 12V/πD

V is the cutting speed(120 fpm) and D is the diameter of the hole( 2 in)

so we substitute

Ns = 12 × 120 / π2

Ns = 1440 / 6.2831

Ns = 229.18 rmp

Now we find the metal removal rate using the equation

MRR = (πD²/4) Fr × Ns

Fr is the feed rate( 0.02 ipr ),

so we substitute

MRR = ((π × 2²)/4) × 0.02 × 229.18

MRR = 14.3998 ≈ 14.4 in³/min

Therefore the metal removal rate is 14.4 in³/min

Next we find the allowance for approach of the tip of the drill

A = D/2

A = 2/2

= 1 in

now find the time required to drill the hole

Tm = (L + A) / (Fr × Ns)

Lis the the depth of the hole( 3.5 in)

so we substitute our values

Tm = (3.5 + 1) / (0.02 × 229.18  )

Tm = 4.5 / 4.5836

Tm = 0.98 min

Therefore the cutting time is 0.98 min

8 0
2 years ago
PLEASE ANSWEAR FAST!!! <br> What does it mean if E˂1
Citrus2011 [14]
Scientific notation is another way to write a number. In scientific notation, the letter E is used to mean "10 to the power of." For example, 1.314E+1 means 1.314 * 101 which is 13.14 . Scientific notation is merely a format used for input and output.
5 0
2 years ago
Plis 3 conclusiones de este video
vazorg [7]
No hay videos? de cual video estás hablando?
6 0
2 years ago
Do you think for security reasons everything that happens on the internet should be analyzed by the public security services ?
givi [52]

Answer: yes

Explanation: People post bad things that i think should get taken down i was on an app the other day and people were posting bad things

8 0
3 years ago
You are ordering steel cable for a 250 foot long zip-line you are building in your back yard. The cable can be ordered in diamet
Margarita [4]

Answer:

If i am correct It should be 1/4 of an inch

Explanation:

Sorry but i can't quite explain

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following ranges depicts the 2% tolerance range to the full 9 digits provided?
    6·1 answer
  • Which statement is true for the relay logic diagram shown below?
    9·1 answer
  • python Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month an
    7·1 answer
  • A signalized intersection approach has three lanes with no exclusive left or right turning lanes. The approach has a 40-second g
    10·1 answer
  • A train which is traveling at 70 mi/hr applies its brakes as it reaches point A and slows down with a constant deceleration. Its
    12·1 answer
  • What is the lowest Temperature in degrees C?, In degrees K? in degrees F? in degrees R
    5·1 answer
  • If the power to a condensing unit has been turned off for an extended period of time, the _________________________ should be en
    12·1 answer
  • Hello, I have a question, I would be glad if you can help.
    5·1 answer
  • Technician A says a 50/50 mix of antifreeze and
    8·1 answer
  • 1)What are the three previous manufacturing revolutions Mr. Scalabre mentions? When did these take place?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!