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
How do you solve -4+3x&lt;/= -12 +5x? inequalities
navik [9.2K]
You were trying to write -4+3x≤12+5x

remember, you can do anything to an equaiton as long as you do it to both sides

-4+3x≤-12+5x
minus 3x both sides
-4≤-12+2x
add 12 to both sides
8≤2x
divide both sides by 2
4≤x
x≥4
x≥7.5
6 0
2 years ago
Find an equation of the line passing through each of the following pairs of points.
Ksivusya [100]
To find the equation of the line we will need to find slope and the y-intercept.
 
Given: (-3,9), (-3,-5)
 
What we know:
slope=m=(y2-y1)/(x2-x1)
           m=(-5-9)/9-3-(-3))=-14/0
           m=undefined

When slope=m is undefined we have an a line x=-3. That means that for every y the x value is always -3. This line x=-3 is a vertical line on the graph at -3.
 
5 0
3 years ago
Can someone please help me
Reil [10]

Answer:

Mark answer C and D as correct

Step-by-step explanation:

Recall that a bisector cuts the side in two equal segments, then KH has to be half of 136 that is KH = 68

Also KHZ and HLZ are right angle triangles that share the same hypotenuse, so they are congruent triangles, which means that HL must equal KH  and therefore the full side HJ must be 68 times 2 = 136

5 0
3 years ago
The table shows two sequences of numbers.
DochEvi [55]

Answer:

You multiply by 6 and the 5th term is 60

Step-by-step explanation:

15*4 = 60

3 0
3 years ago
Read 2 more answers
Can someone help? Please
MrRa [10]

Answer: I can’t help with that because there should be a graph

Step-by-step explanation:

4 0
3 years ago
Other questions:
  • Which of the following sets is equal to {1,2,3...}?
    5·1 answer
  • Which point best approximates.. ( picture shown )
    9·1 answer
  • Selina and three of her classmates each wrote out the steps for finding an approximate percent change. They all agreed on the fi
    9·2 answers
  • Amy, since you know something about algebra, you can probably help me out with this. what is the value of x in the equation x2 +
    14·1 answer
  • Carla is ordering pizzas for delivery. Each pizza costs $8 , and there is a $6 delivery charge per order.
    13·2 answers
  • A jet flies at a rate of 1.3x10^3 feet per hour . Written in scientific notation which is the best estimate of how many feet the
    12·1 answer
  • Points J and Klie in plane H.<br> How many lines can be drawn through points J and K?
    8·2 answers
  • Please help me with number 4
    9·2 answers
  • Simplify 400-[200+35-70(100/25)}] hurry plz
    6·2 answers
  • Which is the graph of g(x) = (0.5)x+ 3 – 4?<br> 1
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!