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
I really need help please
Iteru [2.4K]
Answer is C
Because 2 is your Y intercept and -1/2 means your going to move down 1 then move 2 to the right
7 0
2 years ago
Read 2 more answers
Which numbers are perfect squares? Check all that apply.
blagie [28]

Answer:

16, 100, 1,

Step-by-step explanation:

A perfect square is a number multiplied by itself to get that number. So 16 would be 4*4 and 100 would be 10*10, then 1 would just be 1*1

7 0
2 years ago
Read 2 more answers
Why is water not used as a solvent in paper chromatography​
Anastaziya [24]

Answer:

Because the kind of compounfds that you try to determine using paper chromatography (organic compounds) are usually not soluble in water. Furthermore, water could react chemically with some of this compounds, because it's a very reactive molecule. You need organic solvents that are mostly inert.

8 0
3 years ago
2 x 9 = 8 + w <br><br> please show work. best answer will get brainliest.
hichkok12 [17]

Answer:

2 \times 9 = 8 + w \\ 18 = 8 + w \\ 18 - 8 = w \\ 10 = w \\ thank \: you

4 0
3 years ago
Read 2 more answers
Help me with this question​
Scrat [10]
In my calculation it’s 4
7 0
3 years ago
Other questions:
  • Simplify.
    6·1 answer
  • The distance traveled by a falling object is directly proportional to the square of the time it takes to fall that far. If the o
    13·1 answer
  • Fill in the blank with the phrase that makes the proof statement true.
    5·1 answer
  • When a force causes an object to move, what happens?
    9·1 answer
  • What is the diameter of this circle if the circumference is 18x inches?
    11·2 answers
  • Write the equation of the ellipse with center (4,2), vertex (9,2), and focus (4+2sqrt5,2)
    5·1 answer
  • Can someone plz be nice and give me the answer:)
    13·1 answer
  • Solve the logarithmic equation. Be sure to reject any value of log (X + 8) = log x + log 8​
    12·2 answers
  • PLEASE ANSWER FAST. Bill needs $37,000 every year and earns $27.90 per hour.
    13·1 answer
  • Please help i have no idea how to answer this
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!