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
why did my dirtbike just stop when i was riding it, and now when i start it it sounds like it has a knock, and wont stay running
chubhunter [2.5K]

Answer: check the engines i swear if ur talking about an actual bike im gonna be so embarrassed lma0

7 0
3 years ago
Read 2 more answers
Consider a solid circular shaft subjected to bending and torsion so that the state of stress of interest involves only a normal
Alex17521 [72]

Answer:

The detailed explanation of answer is given in attached file.

Explanation:

7 0
4 years ago
Aerospace engineers who work for certain government agencies are often required to have security clearance. Explain two reasons
yuradex [85]

Answer:

Two reasons that justify the requirement for security clearance for aerospace engineers working for government agencies are;

1) Such engineers have access to data regarding the blueprint, components, method of construction, functionality status, new systems design, future systems design, inventory of systems and aeronautical systems database which are sensitive information that are of high importance to the federal government

2) Such engineers take part in the testing of aeronautic equipment, and will require security clearance to be able to input data results into the data base of the aeronautic equipment

Explanation:

3 0
3 years ago
What is your Favorite Diesel Truck?
jok3333 [9.3K]

Answer:

Race truck go vroom

Explanation:

Truck go fast

3 0
3 years ago
Read 2 more answers
This method will sell the seat in row i and column j unless it is already sold. A ticket is sold if the price of that seat in th
blsea [12.9K]

Answer:

The solution code is written in Java.

  1. public class Movie {
  2.    private double  [][] seats = new double[5][5];
  3.    private double totalSales;
  4.    public Movie(){
  5.        for(int i= 0; i < this.seats.length; i++){
  6.            for(int j = 0; j < this.seats[i].length; j++){
  7.                this.seats[i][j] = 12;
  8.            }
  9.        }
  10.        this.totalSales = 0;
  11.    }
  12.    public boolean bookSeat(int i, int j)
  13.    {
  14.        if(this.seats[i][j] != 0){
  15.            this.totalSales += this.seats[i][j];
  16.            this.seats[i][j] = 0;
  17.            return true;
  18.        }else{
  19.            return false;
  20.        }
  21.    }
  22. }

Explanation:

The method, bookSeat(), as required by the question is presented from Line 16 - 26 as part of the public method in a class <em>Movie</em>.  This method take row,<em> i</em>, and column,<em> j</em>, as input.

By presuming the seats is an two-dimensional array with all its elements are  initialized 12 (Line 7 - 10). This means we presume the movie ticket price for all the seats are $12, for simplicity.

When the<em> bookSeat() </em>method is invoked, it will check if the current price of seats at row-i and column-i is 0. If not, the current price, will be added to the <em>totalSales </em>(Line 19)<em> </em>and then set the price to 0 (Line 20) and return <em>true</em> since the ticket is successfully sold (Line 21).  If it has already been sold, return <em>false</em> (Line 23).

8 0
4 years ago
Other questions:
  • Estimate the theoretical fracture strength of a brittle material if it is known that fracture occurs by the propagation of an el
    10·2 answers
  • Air flows steadily through a turbine that produces 3.5x 105 ft-lbf/s of work. Using the data below at the inlet and outlet, wher
    14·1 answer
  • To use wiring diagrams, an understanding of the symbols, abbreviations, and connector coding used in the diagrams
    12·1 answer
  • Apply the particle under a net force model to the block in the horizontal direction:1) Fx = F cos θ - fk - T = m2ax = m2aApply
    15·1 answer
  • The Republican National Committee publishes a monthly digest of information for Republicans called .
    15·1 answer
  • What was the opening price of Dow Jones Industrial Average on July 06,2017 in the format of XXXXX.XX?
    15·1 answer
  • La osteoporosis puede presentarse en la epoca de el embaraso y la lactancia
    9·1 answer
  • Which statement is WRONG?
    13·1 answer
  • Correctly complete the statement below with the appropriate term.
    8·1 answer
  • Describe the potential evidences of child hood fixation that show up in adult personality?​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!