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
Define online pollution
Elis [28]

Explanation:

E-Pollution is the environmental damage that comes from the constant heat and cooling down in facilities that are referred to data centers. Data centers are where online information is collected, processed, stored and exchanged.

4 0
2 years ago
Which of the following is part of the 6-by-6 rule?<br><br> i need help!!!!!
Digiron [165]
No more than six lines, and no more than six words in a 6 by 6 rule.
5 0
2 years ago
Which components are involved with input? Output? Processing? Storage?
VMariaS [17]

Answer: Output

input keyboard mouse joystick graphics tablet trackball touchpad touchscreen microphone sensor      

Processing     processor (CPU) processor (GPU) memory motherboard

Output printer monitor touchscreen plotter speakers headphones motor data projector

Explanation:

5 0
2 years ago
Read 2 more answers
When performing the ipconfig command, what does the following output line depict if found in the tunnel adapter settings?
Andrew [12]

Answer:

d. IPv4 Address 192.168.0.4 is associated with the globe IPv6 address 2001:db8:0:10:0:efe

Explanation:

The adapter setting will be associated with the global IP address. When Ipconfig command is operate the IP address finds the relevant domain and then address will use a different subnet. The network will use both IPv4 and IPv6 subnets in order to execute the command.

8 0
2 years ago
Is there a way to search your computer for all music files on it?
Slav-nsk [51]
Yes their is a way go to your downloads see if you have some thing or their shall be something that you can type in your computer and find something or you can go to Youtube or google and they can show you a video or some articles.
5 0
3 years ago
Other questions:
  • Net Worth is equal to assets minus liabilities. Which event will have the greatest impact (positive or negative) on one's net wo
    5·1 answer
  • A ____ operating system should be capable of supporting the applications and tools necessary to support Internet operations.
    10·1 answer
  • Which of the following is true regarding packaged software and custom software? Group of answer choices Packaged software are ap
    13·1 answer
  • How do I logout of Brainly on mobile? When I went to settings, it had the option to log out but it was grayed out.
    14·1 answer
  • Which term refers to the capability of a switch to copy data from any or all physical ports on a switch to a single physical por
    5·1 answer
  • "which type of network connects smart devices or consumer electronics within a range of about 30 feet (10 meters) and without th
    7·1 answer
  • A small company with 100 computers has hired you to install a local area network. All of the users perform functions like email,
    9·1 answer
  • Create a class to represent light bulbs
    7·1 answer
  • define the term computer hardware and its various types mentioning 5 examples of IP or devices with one diagram each​
    9·1 answer
  • Describe how you will lunch a web browser using the start menu​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!