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
lions [1.4K]
3 years ago
8

Using a queue.

Engineering
1 answer:
beks73 [17]3 years ago
7 0

Answer:

// Radix Sort

#include<iostream>

using namespace std;

// function to get max value

int getMaximum(int array[], int n)

{

int max = array[0];

for (int i = 1; i < n; i++)

if (array[i] > max)

max = array[i];

return max;

}

// function to get min value

int getMinimum(int array[], int n)

{

int mn = array[0];

for (int i = 1; i < n; i++)

if (array[i] <mn)

mn= array[i];

return mn;

}

//counting sort

void counterSort(int array[], int n, int expo)

{

int out[100]; // out max

int i, count[10] = {0};

// Store count of occurrences in count[]

for (i = 0; i < n; i++)

count[ (array[i]/expo)%10 ]++;

// Change count[i] so that count[i] now contains actual

// position of this digit in out[]

for (i = 1; i < 10; i++)

count[i] += count[i - 1];

// construct the out max

for (i = n - 1; i >= 0; i--)

{

out[count[ (array[i]/expo)%10 ] - 1] = array[i];

count[ (array[i]/expo)%10 ]--;

}

for (i = 0; i < n; i++)

array[i] = out[i];

}

void counterSortDesc(int array[], int n, int expo)

{

int out[100]; // out max

int i, count[10] = {0};

// Store count of occurrences in count[]

for (i = 0; i < n; i++)

count[ (array[i]/expo)%10 ]++;

for (i = 10; i >=1; i--)

count[i] += count[i - 1];

// construct out max

for (i = 0; i >= n-1; i++)

{

out[count[ (array[i]/expo)%10 ] - 1] = array[i];

count[ (array[i]/expo)%10 ]++;

}

// Copy the out max to array[], so that array[] now

// contains sorted numbers according to current digit

for (i = 0; i < n; i++)

array[i] = out[i];

}

// Radix Sort function

void radixsort(int array[], int n)

{

// get maximum number

int m = getMaximum(array, n);

for (int expo = 1; m/expo > 0; expo *= 10)

counterSort(array, n, expo);

}

void radixsortDesc(int array[], int n)

{

// get minimum number

int m = getMinimum(array, n);

for (int expo = 1; m/expo > 0; expo *= 10)

counterSortDesc(array, n, expo);

}

// print an max

void print(int array[], int n)

{ cout<<"\n";

for (int i = 0; i < n; i++)

cout << array[i] << " ";

}

// Main function

int main()

{

int array[] = {185, 25, 35, 90, 904, 34, 2, 66};

int n = sizeof(array)/sizeof(array[0]);

radixsort(array , n);

print(array, n);

radixsortDesc(array,n);

print(array,n);

return 0;

}

Explanation:

You might be interested in
Quinn’s relatives relayed a story about putting on a headset and seeing a digital world that they could walk around in and explo
Kryger [21]

Answer:

I know it is C)Virtual reality

Explanation:

Look at the clues

story about putting on a headset ( virtual reality head set!)

seeing a digital world (A virtual reality world)

they could walk around in (Fake walking you are basically jogging in place)

explore in order to see what ancient Benin looked like (Looking at a real place only digitally)

as if they were really there ( they think they are actually there)

The only reason I know all of this is because I have done virtual reality multiple times and I LOVED it SUPER fun ( I was doing archery) :) Hope this helps!

6 0
3 years ago
Read 2 more answers
Tanya Pierce, President and owner of Florida Now Real Estate is seeking your assistance in designing a database for her business
const2013 [10]

Answer:

the answer is attributes for each entity

5 0
3 years ago
It is given that 50 kg/sec of air at 288.2k is iesntropically compressed from 1 to 12 atm. Assuming a calorically perfect gas, d
denis23 [38]

The exit temperature is 586.18K and  compressor input power is 14973.53kW

Data;

  • Mass = 50kg/s
  • T = 288.2K
  • P1 = 1atm
  • P2 = 12 atm

<h3>Exit Temperature </h3>

The exit temperature of the gas can be calculated isentropically as

\frac{T_2}{T_1} = (\frac{P_2}{P_1})^\frac{y-1}{y}\\ y = 1.4\\ C_p= 1.005 Kj/kg.K\\

Let's substitute the values into the formula

\frac{T_2}{T_1} = (\frac{P_2}{P_1})^\frac{y-1}{y} \\\frac{T_2}{288.2} = (\frac{12}{1})^\frac{1.4-1}{1.4} \\ T_2 = 586.18K

The exit temperature is 586.18K

<h3>The Compressor input power</h3>

The compressor input power is calculated as

P= mC_p(T_2-T_1)\\P = 50*1.005*(586.18-288.2)\\P= 14973.53kW

The compressor input power is 14973.53kW

Learn more on exit temperature and compressor input power here;

brainly.com/question/16699941

brainly.com/question/10121263

6 0
2 years ago
The proposed grading at a project site will consist of 25,100 m3 of cut and 23,300 m3 of fill and will be a balanced earthwork j
Anna [14]

Answer:

the volume of water that will be required to bring these soils to the optimum moisture content is 1859 kL

Explanation:

Given that;

volume of cut = 25,100 m³

Volume of dry soil fill = 23,300 m³

Weight of the soil will be;

⇒ 93% × 18.3 kN/m³ × 23,300 m³

= 0.93 × 426390 kN 3

= 396,542.7 kN  

Optimum moisture content = 12.9 %

Required amount of moisture = (12.9 - 8.3)% = 4.6 %

So,

Weight of water required = 4.6% × 396,542.7 = 18241 kN

Volume of water required = 18241 / 9.81 = 1859 m³

Volume of water required = 1859 kL

Therefore, the volume of water that will be required to bring these soils to the optimum moisture content is 1859 kL

6 0
3 years ago
A square silicon chip (k = 152 W/m·K) is of width 7 mm on a side and of thickness 3 mm. The chip is mounted in a substrate such
Harrizon [31]

Answer:

The steady-state temperature difference is 2.42 K

Explanation:

Rate of heat transfer = kA∆T/t

Rate of heat transfer = 6 W

k is the heat transfer coefficient = 152 W/m.K

A is the area of the square silicon = width^2 = (7/1000)^2 = 4.9×10^-5 m^2

t is the thickness of the silicon = 3 mm = 3/1000 = 0.003 m

6 = 152×4.9×10^-5×∆T/0.003

∆T = 6×0.003/152×4.9×10^-5 = 2.42 K

7 0
3 years ago
Other questions:
  • A dipstick is (a direct,an indirect) measurement device
    13·1 answer
  • A 3-kg block rests on top of a 2-kg block supported by, but not attached to, a spring of constant 40 N/m. The upper block is sud
    14·2 answers
  • You read a research study that concludes that the higher a student's self-esteem, the better he performs in school. This sort of
    5·1 answer
  • Q: Draw shear and bending moment diagram for the beam shown in
    5·1 answer
  • For the Mohr's circle of a plane-strain element, which of the following changes as a result of shear strain change?
    7·1 answer
  • I have a question for you guys
    13·2 answers
  • Which option identifies the type of engineering technician most likely to be involved in the following scenario?
    9·1 answer
  • For an AC machine, what percentage of power is at the negative terminal?
    14·1 answer
  • Find the mean deviation of the set of numbers<br> (a) 12, 6, 7, 3, 15, 10, 18,5
    7·2 answers
  • What is the law of physics<br><br><br> 10 points if you tell me the answer and your name
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!