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
juin [17]
3 years ago
8

An array is sorted (in ascending order) if each element of the array is less than or equal to the next element .

Computers and Technology
1 answer:
Aleks04 [339]3 years ago
8 0

Answer:

// The program below checks if an array is sorted or not

// Program is written in C++ Programming Language.

// Comments are used for explanatory purpose

//Program Starts here

#include<iostream>

using namespace std;

//Function to check if the array is sorted starts here

int isSorted(int arr[], int count)

{

// Check if arrays has one or no elements

if (count == 1 || count == 0) {

return 1;

}

else

{

// Check first two elements

if(arr[0] >= arr[1])

{

return 0; // Not sorted

}

else

{ // Check other elements

int check = 0;

for(int I = 1; I<count; I++){

if (arr[I-1] > arr[I]) { // Equal number are allowed

check++; // Not sorted

}

}

}

if(check==0)

return isSorted(arr, count - 1); //Sorted

else

return 0; // Not sorted

}

// Main Method starts here

int main()

{

int count;

cin<<count;

int arr[count];

for(int I = 1; I<=count; I++)

{

cin>>arr[I-1];

}

int n = sizeof(arr) / sizeof(arr[0]);

if (isSorted(arr, n))

cout << "Array is sorted";

else

cout << "Array is not sorted";

}

You might be interested in
How do i build a supercomputer.?
stira [4]
You will need one head node, at least a dozen identical compute nodes, an Ethernet switch, a power distribution unit, and a rack. Determine the electrical demand, cooling and space required. Also decide on what IP address you want for your private networks, what to name the nodes, what software packages you want installed, and what technology you want to provide the parallel computing capabilities
3 0
3 years ago
What are the six peripherals of a computer system
Lubov Fominskaja [6]
Peripherals fall into three categories:
1. input devices are devices that put commands inside computers such as keyboards, mouses, and joysticks but the first two are the mostly used nowadays
2. output devices are what computers give out such as monitors, printers, speakers and I think projectors also fall into that category
3.storage devices such as a optical drive, hard drive, SDD, flash drive
So the main ones might be a mouse, keyboard, monitors, I think printers, hard drives and flash drives but speakers might be considered as one instead of a flash drive.

4 0
3 years ago
Is part of a computer's hardware that executes each instruction in a program?
zlopas [31]
The CPU, or central processing unit, is the hardware that takes most of the load when running a program. It will perform complex calculations and execute every instruction as the program continues.

The GPU, or graphics procession unit, is the hardware that could also play a major roll in calculating the instructions to execute a program, though this depends on how graphically intensive the program is. For example, games would use a lot more GPU power than say a simple calculator application.
7 0
3 years ago
Why are computers assigned IP addresses
user100 [1]

Answer:

An Internet Protocol address (IP address) is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. An IP address serves two main functions: host or network interface identification and location addressing.

Explanation:

8 0
3 years ago
A network technician configures a firewall’s ACL to allow outgoing traffic for several popular services such as email and web br
Cerrena [4.2K]

Answer: (B) Allow the firewall to accept inbound traffic to ports 80, 110, 143, and 443

Explanation:

Port 80 is used by HTTP, 110 by pop3 to retrieve emails from web servers, 143 by imap for internet messaging and 443 is used for TCP for websites using SSL. So if the firewall is allowed to accept inbound traffic to these ports 80,110,143 and 443 then it would be possible to retrieve emails.

3 0
3 years ago
Other questions:
  • Suppose you send data to the 11111111 11111111 11111111 11111111 ip address on an ipv4 network. to which device(s) are you trans
    15·1 answer
  • Help with some questions. Thank you!
    14·1 answer
  • Given the code segment below, complete the assignments as stated in the comments. struct aaa { int m; int nn; } struct bbb{ stru
    13·1 answer
  • Using either a UNIX or a Linux system, write a C program that forks a child process that ultimately becomes a zombie process. Th
    8·1 answer
  • Prove each statement using a proof by exhaustion. For every integer n such that 0 lessthanorequalto n &lt; 3, (n + 1)^2 &gt; n^3
    9·1 answer
  • The communication channel used in IMC must rev: 12_06_2018_QC_ CDR-223 Multiple Choice match the traditional channel used in tha
    14·1 answer
  • The objects that you place on master pages are called _____.
    6·1 answer
  • What is lasso tool write the name of any modelling and animation software<br>​
    8·1 answer
  • Consider the following method:
    14·1 answer
  • after adding a sound to a slide, the audio tools tab will allow you to apply artistic effects and quick styles to your sound ico
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!