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
Who wants to be my tutor?
anzhelika [568]

Answer:

i would but im not big brain

Explanation:

8 0
3 years ago
Read 2 more answers
What is the point of having bullets points in a text box
Ludmilka [50]
You should have bullets in a text box in case you have a list of stuff. For example:

Computer Parts

.Tower

.Monitor

. Mouse

.Printer


3 0
3 years ago
What is the default file name in Word??? Plzzzz help me!!!!!
kondaur [170]
If your document does not have any text in it and you haven't set the “Title” property, Word inserts “DocX.docx” as the file name, where the “X” is a number that depends on how many new documents you have created during your current Word session.
7 0
3 years ago
Read 2 more answers
Different methods of developing useful information from large data bases are dealt with under
oee [108]

Answer:

The answer to this question is option "d".

Explanation:

In this question, the answer is data mining. Because Data mining is a technique that finds a piece of new information in a lot of the data. In the data mining collecting information from data is hopefully both new and useful. Data mining help us to discover new patterns and relationship in data to help make better decisions. It is used everywhere like Television and radio, Banking, Retail, and business. That's why data mining is useful.

4 0
3 years ago
Why is accessing a disk block expensive? discuss the time components involved in accessing a disk block. (?
Dahasolnce [82]

Answer:

Explanation:

A disk block works by transferring data between the disk and main memory units which are called the blocks, whose size can range drastically from 512 bytes to several thousand.  This data is converted to hardware-level cylinder, surface, and sector number  which makes accessing the data immensely slower than accessing data in the main memory. This time constraint is also the main reason as to why accessing a disk block is so expensive.

6 0
3 years ago
Other questions:
  • Question 16 (2 points) Question 16 Unsaved
    11·1 answer
  • Which of the following is 1000 of a second​
    15·1 answer
  • Which buttons should you use to publish and change a message on a message board
    6·2 answers
  • 1.the following code example would print the data type of x, what data type would that be?
    12·1 answer
  • Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
    9·1 answer
  • jeff has just upgraded from windows 7 to windows 10 and he is confused. He has started several universal apps but he can't figur
    11·1 answer
  • Create a dictionary that maps a fruit name to its color. Both the keys and the values should be stored as strings. Include only
    7·1 answer
  • Expectation on Information Technology Fundamental​
    12·1 answer
  • What is the meaning of HML​
    12·2 answers
  • What is analog computer? where is it used​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!