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
72 is equal to 80% of a number n. Write and solve and equation to find n. Write the percent as a decimal.
valentina_108 [34]
Well I'm not sure what the answer would be since I'm not that smart but I did get the answer of 90, I did this by dividing 72 by 80 which equals .9 and I multiplied that by 100 and got 90.
4 0
3 years ago
Read 2 more answers
Please someone help me with this asap! Giving brainliest !!!!!!!!!
Lina20 [59]

Answer:

I thank its b not sure sorry if its wrong

3 0
2 years ago
Read 2 more answers
What is the area of this figure
anastassius [24]

Answer:

185

Step-by-step explanation:

sorry. had to do something but im bsck :)

5 0
3 years ago
Read 2 more answers
A 10% increase followed by another 10% increase is not the same as a total increase of
AlexFokin [52]

Answer:

21%

Step-by-step explanation:

Another 10% increased means it becomes 110*110/100 = 121. The first 10% increase means the second 10% increase will be an actual 11% increase from the original, so it will be a total of 21%.

6 0
3 years ago
Read 2 more answers
[ Let f ( x ) ] = [ 3 x 2 + 2 x ] , [ g ( x ) ] = [ 3 x + 9 ] , [ h ( x ) ] = [ 12 + x ] , [ What is f ( g ( 3 ) ) ? ] [ Let f (
Pachacha [2.7K]

Answer:

The value of f(g(3) =  1,008

Step-by-step explanation:

<u>Step:-1</u>

Given f(x) =3 x ^ 2 + 2 x

and g(x) = 3x+9

      h(x) = 12+x

Given g(x) = 3x+9

  put x =3

      g(3) = 3(3)+9

      <u>  g(3) = 18</u>

<u>Step :-(2)</u>

f(g(3)) = f(18)

f(g(3) = 3(18)^2 +2(18) (since f(x) =3 x ^ 2 + 2 x)

        = 1,008

<u>Final answer</u>:-

The value of f(g(3) =  1,008

8 0
3 years ago
Other questions:
  • 33.06 is 228% of what number?
    13·1 answer
  • What is 7,464,000.55 rounded to the nearest hundred thousand?
    14·2 answers
  • The ballpark made a total of $15,000 from ticket sales at Wednesday's game. The ballpark charges $20 for each adult ticket and $
    6·1 answer
  • 1/2 divided by 4=______
    11·1 answer
  • X plus x equals what?
    6·2 answers
  • Jessica Jones $425 per week working at a hair salon the weekly expenses are $93.50. What percentage of weekly income goes to pay
    12·1 answer
  • Which of the following is a benefit to using a random sample for an observational study?
    13·2 answers
  • Which equation is represented by the line
    9·1 answer
  • (10)/(4)&lt;(z+8)/(2)&lt;(22)/(4)
    5·1 answer
  • 16÷(2+12)2<br> What is the answer?<br><br> 2 14/25<br><br> 4 1/4<br><br> 6 2/5<br><br> 8 1/4
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!