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
e-lub [12.9K]
3 years ago
6

Consider an array of length n containing positive and negative integers in random order. Write C++ code that rearranges the inte

gers so that the negative integers appear before the positive integers. Your solution should use
a. O(n2) operations
b. O(n) operations
Computers and Technology
1 answer:
Vika [28.1K]3 years ago
3 0
A=243484318731872913781675784
You might be interested in
In a mailbox based message passing system, a process is not put in a waiting queue but receives an error signal upon sending to
Daniel [21]

Answer:

Yes.

Explanation:

Race condition can be described as a situation where at any time there are two or more processes or threads operating concurrently, there is potential for a particularly difficult class of problems. The identifying characteristic of race conditions is that the performance varies depending on which process or thread executes their instructions before the other one, and this becomes a problem when the program runs correctly in some instances and incorrectly in others. Race conditions are notoriously difficult to debug, because they are unpredictable, unrepeatable, and may not exhibit themselves for years.

6 0
3 years ago
A constructor can be overloaded with more than one function which has the same name but with what two different things
andreyandreev [35.5K]
<h2>Answer:</h2>

i. Number of parameters

ii. Type of parameters

<h2>Explanation:</h2>

When there are two or more constructors, definitely with the same name, in a given class, then the constructors are said to be overloaded. An overloaded constructor appears declared many times in a class but each time with different number of parameters and/or type of parameters.

For example, given a class Test, the following combination of constructors can exist;

i. public Test(int x){

   

 }

ii. public Test(String m){

     

  }

iii. public Test(int a, String b){

 

}

<em>The following should be noted;</em>

In the case of combination (i) and (ii), the constructors have the same number of parameters but different type of parameter. In other words, they both have 1 parameter but while the first one has a parameter type of <em>int</em>, the second has a parameter type of <em>String</em>.

In the case of combination (ii) and (iii), the constructors have different number of parameters and of course different type of parameters. In other words, the second constructor has 1 parameter of type <em>String</em> while the third constructor has 2 parameters of types <em>int</em> and <em>String</em>.

5 0
3 years ago
Explain the risks to privacy from collecting and storing personal data on computer systems and the programmer’s role to safeguar
Deffense [45]

Answer:

The risks is If your computer is stolen, someone  could get the data and If your laptop messes up you will you lose all the data.

Explanation:

7 0
2 years ago
Write two recursive versions of the function minInArray. The function will be given a sequence of elements and should return the
Viktor [21]

Answer:

Following are the code to this question:

#include <iostream>//defining header file

using namespace std;//using namespace

int minInArray1(int arr[],int arrSize)//declaring method minInArray1

{

if(arrSize == 1)//use if block to check arrSize value is equal to 1  

{

return arr[0];//return first element of array

}

else //defining else block

{

int max= minInArray1(arr, arrSize-1);//use integer variable max to call method recursively  

if(arr[arrSize-1] < max)//use if block to check array value  

{

max = arr[arrSize-1];//use max to hold array value

}

return max;//return max variable value

}

}

int minInArray2(int arr[], int low, int high)//defining a method minInArray2  

{

if(low == high) //use if to check low and high variable value are equal

{

return arr[low];//return low variable value

}

else //defining else block

{

int minimum = minInArray2(arr, low+1, high);//defining integer variable minimum to call method minInArray2 recursively

if(arr[low] < minimum)

{

minimum = arr[low];//use minimum variable to hold array value

}

return minimum;//return minimum value

}

}

int main()//defining main method

{

int arr[10] = { 9, -2, 14, 12, 3, 6, 2, 1, -9, 15 };//defining an array arr

int r1, r2, r3, r4;//defining integer variable

r1 = minInArray1(arr, 10);//use r1 variable to call minInArray1 and hold its return value

r2 = minInArray2(arr, 0, 9);//use r1 variable to call minInArray2 and hold its return value

cout << r1 << " " << r2 << endl; //use print method to print r1 and r2 variable value

r3 = minInArray2(arr, 2, 5);//use r3 variable to call minInArray1 and hold its return value

r4 = minInArray1(arr + 2, 4); //use r4 variable to call minInArray2 and hold its return value

cout<<r3<< " " <<r4<<endl; //use print method to print r3 and r4 variable value

return 0;

}

Output:

please find the attached file.

Explanation:

In the given code two methods, "minInArray1 and minInArray2" is defined,  in the "minInArray1" it accepts two-variable "array and arrSize" as the parameter, and in the "minInArray2" method it accepts three integer variable "array, low, and high" as the parameter.

  • In the "minInArray1" method, and if the block it checks array size value equal to 1 if the condition is true it will return the first element of the array, and in the else block the max variable is defined, that calling method recursively
  • and store its value.
  • In the "minInArray2" method, an if the block it checks low and high variable value is equal. if the condition is true it will return a low array value. In the next step, the minimum value is defined, which checks the element of the array and uses a low array to store its value.
  • In the main method an array and four integer variable "r1, r2, r3, and r4" is defined, which calls two methods "minInArray1 and minInArray2" and use print method to print its value.
7 0
2 years ago
Internal monitoring is accomplished by inventorying network devices and channels, IT infrastructure and applications, and inform
gtnhenbr [62]

Answer:

True

Explanation:

It is TRUE that Internal monitoring is accomplished by inventorying network devices and channels, IT infrastructure and applications, and information security infrastructure elements.

The above statement is true because Internal Monitoring is a term used in defining the process of creating and disseminating the current situation of the organization’s networks, information systems, and information security defenses.

The process of Internal Monitoring involved recording and informing the company's personnel from top to bottom on the issue relating to the company's security, specifically on issues about system parts that deal with the external network.

5 0
3 years ago
Other questions:
  • When data are entered into a form and saved, they are placed in the underlying database as knowledge?
    10·1 answer
  • What protein is found in hair and nails
    15·2 answers
  • The use of encryption and authentication protocols is the standard method of countering attempts to alter or insert transmission
    9·1 answer
  • If johanna wants to label the x- and y-axes, she should click Layout, then
    8·1 answer
  • Load the titanic sample dataset from the Seaborn library into Python using a Pandas dataframe, and visualize the dataset. Create
    10·1 answer
  • Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (a
    8·1 answer
  • What is one of the most effective security tools available for protecting users from external threats?
    15·1 answer
  • Draw AND, OR, XOR and XNOR gates with truth table and logic gates.<br><br>.​
    11·1 answer
  • The analogy of a computer system is often used to illustrate the different parts of memory. The keyboard is where we encode new
    8·1 answer
  • An end-user license agreement protects _____.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!