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
When inspecting a fire extinguisher: A) The seal should not be broken B) The safety pin should be removed for easier use C) The
dmitriy555 [2]

I believe it’s B, so that you do not accidentally spray out of the hose

8 0
3 years ago
Read 2 more answers
Lenovo's ThinkPad laptop computers is designed in the United States, the case, keyboard, and hard drive are made in Thailand; th
PSYCHO15rus [73]

Answer:

b. A global web of value creation activities

Explanation:

Multinational companies can benefit from creating a global network of value creation activities. With this strategy various phases of the value chain are distributed in several global locations where the cost of value creation is greatly reduced and value maximized. In this scenario Lenovo strategically chooses locations for the manufacturing of components for their ThinkPad laptops, while factoring costs involved and ensuring they are at a minimum. As with any strategy, it has its limitations that can reduce effectiveness such as trade barriers and other political risks.

5 0
3 years ago
The power supply or laptop DC adapter converts the wall outlet DC power into AC power
scoray [572]

Answer:

False.

Explanation:

Its a DC current which charges any equipment which functions on a energy storage  device such as battery. As a battery is a storage device and we know that AC power can't be stored, so chargers are provided with the special type of circuit which converts this AC current into DC.

3 0
3 years ago
Using Task Manager, you discover an unwanted program that is launched at startup. Of the following items, which ones might lead
Harrizon [31]

Answer: Option (a) ,(c) and (e) can become a solution for the problem.

               Option(b) and (d) are not exactly a solution to the issue rather can    be considered on temporary basis

 

Explanation: Windows Task Manager is used for processing task taking place in the system and monitors the performance of that task or program that is running.To stop the unnecessary program execution on the system. methods like searching the source of the program from Task scheduler, startup files or registry key that initiated the execution that unwanted task.

Methods like disabling the program by using Msconfig and Task manager will only deactivate them but they are not eliminated from the source .Thus the appropriate answers would be option(a), (c) and (e).

7 0
3 years ago
Tenemos una fuente de energía de 90 Volts y una resistencia de 30 Ohmios ¿Qué valor tendrá la intensidad de corriente?
Mademuasel [1]

Answer: I do not speak pok

Explanation:

4 0
3 years ago
Other questions:
  • Can you recover deleted bookmarks on a Chromebook? If so, how?
    5·2 answers
  • Whenever I try to plug in my code it will not work. I also need to add 4 more polygons and I don't know where.
    11·1 answer
  • PLZ HELPPPPPPPPPPPPPPPPPPPP
    9·1 answer
  • A. What sectors are used with Foo?
    8·1 answer
  • Why would a programmer want to overload operators rather than use regular member functions to perform similar operations?
    11·1 answer
  • Write a short program that uses a for loop to write the numbers 1 through 10 to a file
    11·1 answer
  • Write a program that reads in the following data, all entered on one line with at least one space separating them: a) an integer
    13·1 answer
  • What is hyperlink and its used in website
    12·1 answer
  • 100 POINTS!
    10·2 answers
  • Dear Brainly, since you don't respond anyother way...
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!