answer.
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
ANTONII [103]
2 years ago
5

c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive

by one, sequentially (as their heights appear in A). For the i-th student, if there is a row in which all the students are taller than A[i], the student will stand in one of such rows. If there is no such row, the student will create a new row. Your task is to find the minimum number of rows created.
Computers and Technology
1 answer:
Lilit [14]2 years ago
4 0

The below code will help you to solve the given problem and you can execute and cross verify with sample input and output.

#include<stdio.h>

#include<string.h>

 int* uniqueValue(int input1,int input2[])

 {

   int left, current;

   static int arr[4] = {0};

   int i      = 0;

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

      {

         current = input2[i];

         left    = 0;

         if(current > 0)

         left    = arr[(current-1)];

      if(left == 0 && arr[current] == 0)

       {

       arr[current] = input1-current;

       }

       else

   {

       for(int j=(i+1);j<input1;j++)

       {

           if(arr[j] == 0)

           {

               left = arr[(j-1)];

               arr[j] = left - 1;

           }

       }

   }

}

return arr;

}

You might be interested in
Choose the person responsible for each innovation.
shepuryov [24]

Answer:

John Blankenbaker

Explanation:

5 0
2 years ago
As the network administrator for a growing isp, you want to make efficient use of your network addresses. one of the network add
lubasha [3.4K]

New Subnet Mask:

255.255.255.240

First 4 subnetwork Addresses:

197.14.88.0

197.14.88.16

197.14.88.32

197.14.88.48

6 0
1 year ago
Create a class named Poem that contains the following fields: title - the name of the poem (of type String) lines - the number o
denpristay [2]

Answer:

Couplet.java



public class Couplet extends Poem

{

private final static int LINES = 2;

public Couplet(String poemName)

{

super(poemName, LINES);

}

}

Haiku.java

public class Haiku extends Poem

{

private static int LINES = 3;

public Haiku(String poemName)

{

super(poemName, LINES);

}

}

Limerick.java

public class Limerick extends Poem

{

private static int LINES = 5;

public Limerick(String poemName)

{

super(poemName, LINES);

}

}

Poem.java

public class Poem

{

private String poemName;

private int lines;

public Poem(String poemName, int lines)

{

this.poemName = poemName;

this.lines = lines;

}

public String getPoemName()

{

return poemName;

}

public int getLines()

{

return lines;

}

}

DemoPoem.java

import java.util.*;

public class DemoPoems

{

public static void main(String[] args)

{

Poem poem1 = new Poem("The Raven", 84);

Couplet poem2 = new Couplet("True Wit");

Limerick poem3 = new Limerick("There was an Old Man with a Beard");

Haiku poem4 = new Haiku("The Wren");

display(poem1);

display(poem2);

display(poem3);

display(poem4);

}

public static void display(Poem p)

{

System.out.println("Poem: " + p.getPoemName() +

" Lines: " + p.getLines());

}

}

Explanation:

The Couplet and Limerick classes should also be <u>extended from Poem class</u>. Also, in display method, you call getTitle(), however, it's written as getPoemName() in the <em>Poem</em> class. You need to change the name.

7 0
1 year ago
Although the optical discs are all 5 ¼”, a CD drive can not read a DVD disc, and a DVD drive can not read a Blu-ray disc. Why no
otez555 [7]

Answer:

For storing the data into a CD, we need to burn it. And the surface of the CD is comprised of the polycarbonate layer that is molded as the spiral tracks over the surface of the CD. And the Data is being stored as a sequence of minute grooves that are called the pits which are encoded on the spiral tracks. And the region in between the pits is known as lands.

The DVD or the digital video dos is based on the optical data storage which is almost the same as the CD. The analog data is transformed into the digital data, and this is encoded on the disc starting from the inside edge, and towards out. This digital information is being encoded into the surface as pits, and the surface acts as the recording layer. A DVD can hold data up to 4.77 to 8 GB.

Since DVD size is bigger than CD, A DVD drive can read CD, but the CD drive cannot read the DVD,

And unlike the above two, which make use of the red laser for reading and writing, the blu ray makes use of the blue laser. Also, it has the smaller pits, tiny beam as well as small track that together make it possible to store around 25 GB of data in one single blue ray disc. And this is five times more than the size of a DVD.  

The Blu ray Discs are good for playing the CD as well as DVD. However, the opposite is not possible due to the size.

Explanation:

Please check the answer section.

4 0
2 years ago
Describe how computers are used to access, retrieve, organize, process, maintain, interpret, and evaluate data and information.
Sonja [21]

Information refers to the meaningful output obtained after processing the data. Data processing therefore refers to the process of transforming raw data into meaningful output i.e. information.Mechanically using simple devices like typewriters or electronically using modern data processing tools such as computers.

8 0
1 year ago
Other questions:
  • In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
    15·1 answer
  • When an author produce an index for his or her book, the first step in this process is to decide which words should go into the
    8·1 answer
  • Write a method called makeStars. The method receives an int parameter that is guaranteed not to be negative. The method returns
    6·1 answer
  • Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without quotes). If after 19
    6·1 answer
  • In the simulation, player 2 will always play according to the same strategy. The number of coins player 2 spends is based on wha
    6·1 answer
  • Write a copy assignment operator for CarCounter that assigns objToCopy.carCount to the new objects's carCount, then returns *thi
    15·1 answer
  • The elements of an integer-valued array can be initialized so that a[i] == i in a recursive fashion as follows: An array of size
    10·1 answer
  • Write a program that has the following String variables: firstName, middleName, and lastName. Initialize these with your first,
    7·1 answer
  • The fact that the speed of a vehicle is lower than the prescribed limits shall relieve the driver from the duty to decrease spee
    11·2 answers
  • Write a program to read-in a sequence of integers from the keyboard using scanf(). Your program will determine (a) the largest i
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!