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
Find the sum of the geometric series 3+12+48+...+12,288
Bond [772]

Answer:

I think that you need to add obvoiusly.

12351 Thats what I got. But Im not sure if its correct. I hope his helps

Step-by-step explanation:

5 0
3 years ago
Read 2 more answers
Simplify −4√−48<br> Help , please ?
Talja [164]
The answer is -16 radical 3
4 0
3 years ago
Solve exponents please help just this one u get 10 points
STALIN [3.7K]
I think it's equal to 1 because every expression with the exponent of zero is equal to 1, idk for sure though
8 0
3 years ago
The polygon Q(3, 2), R(6,5), S(6, 2)
ycow [4]

Answer:

Q' (12,8) , R'( 24,20) and S' (24,8)

Step-by-step explanation:

Here, we want to get the coordinates of the image after dilating the pre-image by a scale factor of 4

What we have to do here is to multiply each of the coordinate on the pre-image by 4

We have this as;

Q' = (4*3, 2 * 4) = (12,8)

R' = (4*6, 4*5) = (24,20)

s' = (4*6, 4*2) = (24,8)

4 0
3 years ago
Which person has the highest hourly <br> wage? How do you know?
Inga [223]

Answer:

Savannah

Step-by-step explanation:

1. Find the unit rate of all of the tables by dividing the values so that you know how much they earn per hour (ex. for Greg, the ratio is 3hours:$27 so divide all values by 3 to get 1hour:$9).

2. Compare all of the unit rate values (Savannah: $9.50 per hour, Greg: $9 per hour, and Kevin: $8.25 per hour).

4 0
3 years ago
Other questions:
  • paul weighed 36 kg Felix weighs half of Paul and Frank weighs 4 kg more than Felix what is there weight all together
    5·1 answer
  • PLZ HELP HEART AND 5 STAR
    10·2 answers
  • What does 40 divided by 1+3-(3x7)+7-5 equal?
    9·1 answer
  • Help me on what is meant by 2cm to represent 1unit on the graph and give me examples.
    9·1 answer
  • What is the first step in evaluating the expression shown below?
    5·1 answer
  • In 4 regular season basketball games, James Harden scored 141 points. Write an equation to represent the number of points scored
    11·2 answers
  • Please help. Thank you I am out of points because people are stealing them.
    15·1 answer
  • Each TTF site bought a new rope bridge for 4,500. TTF will make monthly payments of $350 until the bill is paid. Write an equati
    13·1 answer
  • What property of addition would 3,500+0=3,500 be
    7·1 answer
  • How much time will have elapsed from 2:37 to 3:19
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!