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
Keith_Richards [23]
3 years ago
9

Array processing (elimination of three largest values) (one of many array reduction problems) The array a(1..n) contains arbitra

ry integers. Write a function reduce(a,n) that reduces the array a(1..n) by eliminating from it all values that are equal to three largest different integers. For example, if a=(9,1,1,6,7,1,2,3,3,5,6,6,6,6,7,9) then three largest different integers are 6,7,9 and after reduction the reduced array will be a=(1,1,1,2,3,3,5), n=7. The solution should have the time complexity O(n).
Mathematics
1 answer:
ziro4ka [17]3 years ago
8 0

Step-by-step explanation:

# include <bits/stdc++.h>

using namespace std;

bool find3Numbers(int A[], int arr_size, int sum)

{

int l, r;

sort(A, A+arr_size);

for (int i=0; i<arr_size-2; i++)

{

l = i + 1;

r = arr_size-1;

while (l < r)

{

if( A[i] + A[l] + A[r] == sum)

{

printf("Triplet is %d, %d, %d", A[i],

A[l], A[r]);

return true;

}

else if (A[i] + A[l] + A[r] < sum)

l++;

else // A[i] + A[l] + A[r] > sum

r--;

}

}

return false;

}

int main()

{

int A[] = {1, 4, 3, 2, 10, 8};

int sum = 22;

int arr_size = sizeof(A)/sizeof(A[0]);

find3Numbers(A, arr_size, sum);

return 0;

}

You might be interested in
Help quick. Need fast. Thx
Vlada [557]
2/9×5=10/45
3/5×9=27/45
so 3/5 is bigger then 2/9

5/7×5=25/35
3/5×7=21/35

So 5/7 is larger than 3/5

So from least to greatest the numbers are
2/9 then 3/5 then 5/7

So your answer is A
6 0
3 years ago
Ben and Landon took turns driving on the recent 820 mile road trip Ben averaged 60 mph while Landon average 56 mph if the trip t
AysviL [449]

Answer:

9 hours

Step-by-step explanation:

Let :

Landon hours = x

Ben hours = y

x + y = 14 - - (1)

60x + 56y = 820 - - - (2)

From (1)

y = 14 - x

60x + 56(14 - x) = 820

60x + 784 - 56x = 820

4x = 820 - 784

4x = 36

x = 36/4

x = 9

Landon drove for 9 hours

4 0
3 years ago
Solve the system linear equations, using Gaussian Elimination
otez555 [7]
Just look it up on the web that will help a lot
5 0
2 years ago
I have no idea how to slove this 5x-5 =2×+97​
galina1969 [7]

Answer: x=34

Step-by-step explanation:

1. You subtract 2x from 5x on the other side to get rid of the 2x leaving you with 3x.

2. Then you add 5 to 97 to get rid of the -5, giving you 102 on the opposite side.

3. divide 102 by 3x giving you 34.

5x-5=2x+97

-2x     -2x

3x-5=97                                                                      <u><em>X=102</em></u>

   +5  +5

3x=102

x/3   102/3

4 0
3 years ago
Read 2 more answers
3. Eric filled 3/4 buckets with sand. Then he filled
Sedbober [7]

Answer:

  472 3/4

Step-by-step explanation:

Consider the meaning of "one, and one more". That does not mean zero (1-1). Rather, it means two (1+1).

__

Then 3/4 and 472 more is ...

  \dfrac{3}{4}+472=472\frac{3}{4}

Eric has 472 3/4 buckets filled with sand.

_____

The problem statement here seems to be focused on the filled buckets, rather than the sand stockpile that Eric is working from. The amount in that stockpile is being reduced by the amount that is being used to fill buckets. In short, whether you add or subtract depends on what you're trying to figure.

5 0
3 years ago
Other questions:
  • No multiple choice just solve
    11·1 answer
  • Let ​ f(x)=x2+5x−36 ​. Enter the x-intercepts of the quadratic function in the boxes.
    11·2 answers
  • Batteries come in packs of 4. Last month, Joe used 58 batteries in his remote control drone. How many packs of batteries did he
    11·1 answer
  • A pelican dives straight down from 50.7 feet above the ocean and catches a fish 5.6 feet under the water. What is the total dist
    5·1 answer
  • Can someone explain this to me?​
    14·1 answer
  • After an election in a small town, the newspaper reported that 42% of the registered voters actually voted. If 12,000 people vot
    8·1 answer
  • Apply the technique of using nets to create an equation to solve for the surface area of the rectangular prism. -- Place answers
    10·1 answer
  • What's 950 dividend by 48
    6·2 answers
  • A school is looking to cater an event by having a food truck. Food truck A will charge $1.50 for each item sold and a fee of $50
    6·1 answer
  • A steam fitter earns $19.40 per hour plus time and a half for overtime (more than 40 hours in
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!