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
A group of eight bits is called a _______. a. numeric data b. byte c. megabit d. binary
RideAnS [48]
The answer is B: byte
8 0
3 years ago
Create a single line comment that says ""Print results to screen""
levacccp [35]

Answer:

//""Print results to screen""

Explanation:

In c,c++,java,javascript // is used for the single line comment.

syntax:- // comment.

Whatever text that is followed after // is commented means this line will not get executed by the compiler.

Comments are used to explain the code to other person who is working on the code or trying to understand that code.

6 0
3 years ago
Stephanie is a zoologist who loves the outdoors and often travels the world researching wildlife and serving as a consultant it
Flauer [41]

Answer:

Nature (at all) is the best place for her to work at. Researcher or Environmental activist or Biologist Professor or Zoo care/assistant. All of the mentioned works can be applied to her.

Explanation:

8 0
3 years ago
Read 2 more answers
Whose email address may the agent enter into the applicant information section of LEAN enrollment application
stich3 [128]

It is the customer's email address may be entered into the applicant information section of LEAN enrollment application

<h3>What is LEAN enrollment application?</h3>

LEAN enrollment application is a kind of electronic enrollment program which is specifically designed to make enrollments easier for agent

So therefore, It is the customer's email address which may be entered into the applicant information section of LEAN enrollment application

Learn more about enrollment application:

brainly.com/question/18186504

#SPJ1

6 0
2 years ago
Can someone help me with this one
MAVERICK [17]

Answer:

true

Explanation:

it is because when someone feels better about something that means that their self esteem is building up

8 0
4 years ago
Read 2 more answers
Other questions:
  • 5. You just bought a new hard drive for your computer. You plan to use this as a secondary hard drive to store all your UMA file
    14·1 answer
  • Anybody play apex legends? I need somebody to climb with in comp (I main octane)
    15·1 answer
  • Quantas calorias os adolescentes devem consumir diariamente?
    14·1 answer
  • Which statement about UML class diagrams is true?
    8·1 answer
  • Where can you go in QuickBooks Online to import a list of products and services? Select the Quick Create icon and under the Tool
    12·1 answer
  • The Hydrosphere contains (4 points)
    10·1 answer
  • Using ________ as a promotion method will bring return visitors to your site.
    8·1 answer
  • Is anyone a robIox moderator?
    13·2 answers
  • What is meant by normalization? Occurs when an intrusion detection system labels normal activity as anomalous. The process of tr
    5·1 answer
  • You are querying a database of manufacturing company suppliers. The column name for supplier identification numbers is supplier_
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!