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
VikaD [51]
2 years ago
9

Given a sorted array of integers created on the heap, its size and a new integer, design a function which will enlarge the array

and place the new item in the appropriate position in the array, so that it remains sorted. c++
Computers and Technology
1 answer:
Debora [2.8K]2 years ago
7 0

Using the computational language in C++ to write a code that will organize the values ​​in an array through a mathematical condition.

<h3>writing code in C++</h3>

<em>#include <bits/stdc++.h></em>

<em>using namespace std;</em>

<em>int getIndexInSortedArray(int arr[], int n, int idx)</em>

<em>{</em>

<em>/* Count of elements smaller than current</em>

<em>element plus the equal element occurring</em>

<em>before given index*/</em>

<em>int result = 0;</em>

<em>for (int i = 0; i < n; i++) {</em>

<em>if (arr[i] < arr[idx])</em>

<em>result++;</em>

<em>if (arr[i] == arr[idx] && i < idx)</em>

<em>result++;</em>

<em>}</em>

<em>return result;</em>

<em>}</em>

<em>int main()</em>

<em>{</em>

<em>int arr[] = { 3, 4, 3, 5, 2, 3, 4, 3, 1, 5 };</em>

<em>int n = sizeof(arr) / sizeof(arr[0]);</em>

<em>int idxOfEle = 5;</em>

<em>cout << getIndexInSortedArray(arr, n, idxOfEle);</em>

<em>return 0;</em>

<em>}</em>

See more about C++ at brainly.com/question/12975450

#SPJ1

You might be interested in
What happens in Word 2016 when the Home ribbon tab is clicked on?
serg [7]

Answer:

The answar is D.

Explanation:

7 0
3 years ago
Executives of a company deal less with details of the operational activities and deal more with the higher meaningful aggregatio
mylen [45]

Answer:

3. Granularity

Explanation:

Granularity's concept is representing the level of how do we store the data in our database.

If the data are detailed, we can resume the data until get a granularity more strong for our analysis.

For example:

We could store data year by year of our costumers, if want to get more granularity, we could store data month by month, also we could get specific data like how often our customers visit the business or how often our customers buy in a category product.

4 0
2 years ago
Part B How could installing new technology, such as scrubber machines, affect the factories required to install them? Name a pos
Verdich [7]

Answer:It will decrease harmful emissions, so the factories will no longer need to install them.

Explanation:

This helps improve the safety of the surrounding community and workers. But this technology is expensive and required time and effort to install.

5 0
1 year ago
What is the output of the following code snippet? int i = 1; while (i != 9) { System.out.print(i + " "); i++; if (i == 9) { Syst
Monica [59]

Answer:

1 2 3 4 5 6 7 8 End

Explanation:

int i = 1;

while (i != 9){

  System.out.print (i + " ");

  i ++;

  if (i == 9){

     System.out.println("End");

  }

}

7 0
2 years ago
Number of frames displayed per second
Oksi-84 [34.3K]

Are you looking for the abbreviation if so it is FPS

5 0
3 years ago
Other questions:
  • I am sorting data that is stored over a network connection. Based on the properties of that connection, it is extremely expensiv
    14·1 answer
  • Testing for information would be most likely to occur in which type of engineering?
    5·2 answers
  • What disese is sue suffering from
    15·2 answers
  • Which of the following is a valid HTML reference to a CSS file?
    13·1 answer
  • 1. Implement the function dict_intersect, which takes two dictionaries as parameters d1 and d2, and returns a new dictionary whi
    8·1 answer
  • Briefly describe the fundamental differences between project-based and product-based Software Engineering.
    10·1 answer
  • Whois the person start programming​
    13·1 answer
  • What is the output?
    11·1 answer
  • What will be displayed after this code segment is run?
    5·1 answer
  • How do i delete cookies on a chromebook?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!