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
A circular ceramic plate that can be modeled as a blackbody is being heated by an electrical heater. The plate is 30 cm in diame
MakcuM [25]

Answer:

Heater power = 425 watts

Explanation:

Detailed explanation and calculation is shown in the image below

6 0
3 years ago
Effects of adding more insulation to a cylinder increases heat transfer area. a)-True b)-False
Xelga [282]

Answer:

a)-True

Hope this helps even tho theres no school right now

3 0
3 years ago
Modify the Rainfall Statistics program you wrote for Programming Challenge 2 of Chapter 7 . The program should display a list of
rjkz [21]

Answer:

#include<iostream>

#include <iomanip>

using namespace std;

const int NUM_MONTHS = 12;

double getTotal(double [], int);

double getAverage(double [], int);

double getLargest(double [], int, int &);

double getSmallest(double [], int, int &);

double getTotal(int rainFall,double NUM_MONTHS[])

{

double total = 0;

for (int count = 0; count < NUM_MONTH; count++)

total += NUM_MONTH[count];

return total;

}

double getAverage(int rainFall,double NUM_MONTH[])

{getTotal(rainFall,NUM_MONTH)

average= total/NUM_MONTHS;

return average;

}

double getHighest(int rainFall, double NUM_MONTHS[]) //I left out the subScript peice as I was not sure how to procede with that;

{

double largest;

largest = NUM_MONTHS[0];

for ( int month = 1; month <= NUM_MONTHS; month++ ){

                     if ( values[month] > largest ){

                 largest = values[month];

return largest;

          }

double getSmallest(int rainFall, double NUM_MONTHS[])

{

double smallest;

smallest = NUM_MONTHS[0];

for ( int month = 1; month <= NUM_MONTHS; month){

                     if ( values[month] < smallest ){

                 smallest = values[month];

return smallest;

          }

 

int main()

{

double rainFall[NUM_MONTHS];

 for (int month = 0; month < NUM_MONTHS; month++)

  {

     cout << "Enter the rainfall (in inches) for month #";

     cout << (month + 1) << ": ";

     cin >> rainFall[month];

 

     while (rainFall[month] < 0)

     {

      cout << "Rainfall must be 0 or more.\n"

             << "Please re-enter: ";

      cin >> rainFall[month];

     }

  }

  cout << fixed << showpoint << setprecision(2) << endl;

  cout << "The total rainfall for the year is ";

  cout << getTotal(rainFall, NUM_MONTHS)

      << " inches." << endl;

   cout << "The average rainfall for the year is ";

  cout << getAverage(rainFall, NUM_MONTHS)

      << " inches." << endl;

   int subScript;

cout << "The largest amount of rainfall was ";

  cout << getLargest(rainFall, NUM_MONTHS, subScript)

      << " inches in month ";

  cout << (subScript + 1) << "." << endl;

  cout << "The smallest amount of rainfall was ";

  cout << getSmallest(rainFall, NUM_MONTHS, subScript)

      << " inches in month ";

  cout << (subScript + 1) << "." << endl << endl;

  return 0;

}

8 0
3 years ago
100 kg of R-134a at 200 kPa are contained in a piston–cylinder device whose volume is 12.322 m3. The piston is now moved until t
LekaFEV [45]

Answer:

T=151 K, U=-1.848*10^6J

Explanation:

The given process occurs when the pressure is constant. Given gas follows the Ideal Gas Law:

 pV=nRT

For the given scenario, we operate with the amount of the gas- n- calculated in moles. To find n, we use molar mass: M=102 g/mol.  

Using the given mass m, molar mass M, we can get the following equation:  

 pV=mRT/M

To calculate change in the internal energy, we need to know initial and final temperatures. We can calculate both temperatures as:

T=pVM/(Rm); so initial T=302.61K and final T=151.289K

 

Now we can calculate change of U:

U=3/2 mRT/M using T- difference in temperatures

 U=-1.848*10^6 J

Note, that the energy was taken away from the system.  

5 0
4 years ago
What does the word “robot” mean? A.Clone B. Athlete C. Servant D. Actor
hram777 [196]

Answer:

a. clone

Explanation:

4 0
3 years ago
Other questions:
  • In the 1960s through 1980s, a medical filter manufacturer in Ann Arbor discharged 1,4-dioxane (an industrial solvent) directly i
    10·1 answer
  • I need solution for this question please ​
    7·2 answers
  • Project 8:The Harris-Benedict equation estimates the number of calories your body needs to maintain your weight if you do no exe
    5·1 answer
  • The parts of a feature control frame are the tolerance value, the datum references, and the
    14·1 answer
  • Technician A says that in a worm gear steering system, most excessive steering free play is usually found in the gearbox. Techni
    13·1 answer
  • The typical Canadian worker is able to produce 100 board feet (a unit of measure) of lumber or 1000 light bulbs per year. The wo
    12·1 answer
  • Define a separate subroutine for each of the following tasks respectively.
    6·2 answers
  • Draw the free-body diagram of the beam which supports the 80-kg load and is supported by the
    12·1 answer
  • Concrete ___ support and anchor the bottom of steel columns and wood post, which support beams that are pare of framing system o
    11·1 answer
  • In a medical lab, Sandrine is working to isolate one element from a sample of liquid material. She uses a centrifuge, a machine
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!