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
For BitTorrent, which of the following is true:
Bumek [7]

Answer:

d. All of the above

Explanation:

All the above mentioned statements are true about BitTorrent.

8 0
3 years ago
A ___________ variable is used to add up a set of values. fill in the blank
TEA [102]

Answer:

dependent variable -- As it depends on the other variables, changes when they change

3 0
3 years ago
Which of these is unused normal, unvisited link ??
Tomtit [17]

Answer:

hover

Explanation:

hope my answer help you

8 0
3 years ago
To check spelling errors in a document, the Word application uses the _____ to determine appropriate spelling. Internet built-in
Ilya [14]

The answer is built-in dictionary.

Most Microsoft Word versions come with a built-in dictionary for standard grammar and spellings. These dictionaries are not comprehensive. Word also has an additional option to add a spelling error to the dictionary so that the next time you type that same error, it will not come up as a spelling error. In addition, Word can use multiple custom dictionaries that allows you to supplement with the main dictionary and check the spelling of your documents.

6 0
3 years ago
Read 2 more answers
Poshmark is more than a shopping app; it connects people and brings them together. Poshmark is a passionate group of people that
babymother [125]

Poshmark is more than a shopping app. It is known to be a shopping applicationthat links a person to other people whose style one likes.

<h3>What is the aim of Poshmark?</h3>

Poshmark is known to be a shopping app that links a person to other people whose style one likes adore.

It is known to help one to easily shop for any of their closets and boutiques needs. They are known to have about 80 million community members in all of the U.S., Canada, and Australia.

learn more about Poshmark from

brainly.com/question/26258231

8 0
2 years ago
Other questions:
  • Schools are businesses that need to install software on a large number of computers can usually obtain a ______
    13·1 answer
  • In modern computer memory, each location is normally composed of one byte.
    7·1 answer
  • Select the correct answer. Larry finds it easy to run legacy programs and applications in a virtualized environment. How does th
    5·1 answer
  • Given a one dimensional array arr, what is the correct way ofgetting the number of elements in arr
    15·1 answer
  • When Lisa purchased her house the mortgage lender required homeowners insurance to cover 100% of the loan amount. After many yea
    7·2 answers
  • Pick the simplest line of code to test if the word "BASIC" is stored in the variable text1.
    12·1 answer
  • A network slows down when a network card is locked in a perpetual mode
    12·2 answers
  • Drag the correct type of update to its definition.
    14·1 answer
  • Rosa is building a website for a multimedia company. She wants to add a drop-down menu functionality to the website's main page.
    12·1 answer
  • Will mark Brainliest!! What is the best memory to use on a computer? Why?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!