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
RideAnS [48]
3 years ago
5

Suppose values is a sorted array of integers. Give pseudocode that describes how a new value can be inserted so that the resulti

ng array stays sorted.
Engineering
1 answer:
Novosadov [1.4K]3 years ago
7 0

Answer:

insert (array[] , value , currentsize , maxsize )

{

   if maxsize <=currentsize

  {

      return -1

  }

  index = currentsize-1

  while (i>=0 && array[index] > value)

  {

      array[index+1]=array[index]

      i=i-1

  }

 

  array[i+1]=value

  return 0

}

Explanation:

1: Check if array is already full, if it's full then no component may be inserted.

2: if array isn't full:

  • Check parts of the array ranging from last position of range towards initial range and determine position of that initial range that is smaller than the worth to be inserted.  
  • Right shift every component of the array once ranging from last position up to the position larger than the position at that smaller range was known.
  • assign new worth to the position that is next to the known position of initial smaller component.
You might be interested in
An automated transfer line is to be designed. Based on previous experience, the average downtime per occurrence = 5.0 min, and t
IRINA_888 [86]

Answer:

a) 28 stations

b) Rp = 21.43

E = 0.5

Explanation:

Given:

Average downtime per occurrence = 5.0 min

Probability that leads to downtime, d= 0.01

Total work time, Tc = 39.2 min

a) For the optimum number of stations on the line that will maximize production rate.

Maximizing Rp =minimizing Tp

Tp = Tc + Ftd

=  \frac{39.2}{n} + (n * 0.01 * 5.0)

= \frac{39.2}{n} + (n * 0.05)

At minimum pt. = 0, we have:

dTp/dn = 0

= \frac{-39.2}{n^2} + 0.05 = 0

Solving for n²:

n^2 = \frac{39.2}{0.05} = 784

n = \sqrt{784} = 28

The optimum number of stations on the line that will maximize production rate is 28 stations.

b) Tp = \frac{39.2}{28} + (28 * 0.01 * 5)

Tp = 1.4 +1.4 = 2.8

The production rate, Rp =

\frac{60min}{2.8} = 21.43

The proportion uptime,

E = \frac{1.4}{2.8} = 0.5

3 0
3 years ago
What statement exemplifies the role of archeology in architecture?
horrorfan [7]
The answer is B because an architect designs buildings
5 0
3 years ago
The operating sequence to light the main burners on an intermittent pilot system is:______.
11111nata11111 [884]
The pilot valve and spark igniter are energized, the pilot flame is proved, and then the main gas valve is energized.
7 0
2 years ago
g Two Standard 1/2" B18.8.2 dowel pins are to be installed in part B with an LN1 fit. The thickness of plate A is .750 +/- .005"
allochka39001 [22]

Answer:

nmuda mudaf A certain vehicle loses 3.5% of its value each year. If the vehicle has an initial value of $11,168, construct a model that represents the value of the vehicle after a certain number of years. Use your model to compute the value of the vehicle at the end of 6 years.

Explanation:

5 0
3 years ago
A tax on the amount of money a person earns in a year is a
irina [24]

Answer: income tax

Explanation:

7 0
3 years ago
Other questions:
  • What is the name of the model/shape below?
    5·2 answers
  • The flatbed truck carries a large section of circular pipe secured only by the two fixed blocks A and B of height h. The truck i
    14·2 answers
  • Here, we want to become proficient at changing units so that we can perform calculations as needed. The basic heat transfer equa
    15·1 answer
  • Two parts are to be assembled in a way that if one part fails, the entire assembly fails. Each of the parts have undergone exten
    15·1 answer
  • A geothermal heat pump absorbs 15 KJ/s of heat from the Earth 15 m below a house. This heat pump uses a 7.45 kJ/s compressor.
    5·2 answers
  • When will the entropy value of the universe attained its maximum value?
    13·1 answer
  • What is the output of a system with the transfer function s/(s + 3)^2 and subject to a unit step input at time t = 0?
    5·1 answer
  • A smooth sphere with a diameter of 6 inches and a density of 493 lbm/ft^3 falls at terminal speed through sea water (S.G.=1.0027
    11·1 answer
  • Everfi futuresmart module 6 retirement pie chart
    5·2 answers
  • How long does it take to get a master's degree in Mechanical engineering?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!