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]
4 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]4 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
What are the steps to view two different versions of the same document at once? 1. Go to the File tab on the ribbon. 2. Select T
DanielleElmas [232]

Answer:

1.file 2.track changes

Explanation:

thats all i got

3 0
3 years ago
[ASAP!] Which of these can be a problem for people with accessibility issues? Select 4 options.
Elena-2011 [213]

Answer:

<u><em>Flashing images</em></u>

Explanation:

Content that flashes or flickers can trigger seizures in susceptible individuals. Therefore flashing or <u>flickering content should be avoided</u>.

7 0
2 years ago
What is the name of a button on a website?
zhuklara [117]
May I know which button?
5 0
3 years ago
Which of the following is not a method of the history object?
Volgvan

Answer:

replace()

Explanation:

The history object in javascript corresponds to browsing history.

It has the following methods for navigating through the history list:

back(): Go back in the history list

forward(): Go forward in the history list

go() : Navigate to the currently pointed url in the history list. It takes a parameter which can either be a numeric index or a string which is matched with the history list content.

replace() is not a method in the history object.

7 0
3 years ago
In 3-5 sentences describe whether or not files should be deleted from your computer explain your answer
Nata [24]

Answer:

I'm not exacly sure what you mean what type of files?

Explanation:

5 0
3 years ago
Other questions:
  • Technlogies are having a negative impact on business true or false
    7·1 answer
  • Write a method called multiconcat that takes a string and an integer as parameters. return a string that consists of the string
    6·1 answer
  • Technician A says a 2:1 gear ratio doubles the amount of torque. Technician B says a 2:1 gear ratio reduces the speed by half. W
    8·1 answer
  • Explain about RDBMS. Include advantages/ disadvantages. Compare DBMS vs RDBMS. Explain about Oracle as well.
    14·2 answers
  • A ________ allows a hacker to gain access to your computer and take almost complete control of it without your knowledge. zombie
    15·1 answer
  • Excel has more than 400 additional functions that perform just about every type of calculation you can imagine. Answer
    6·1 answer
  • What is a google search query that will search for xml files on the domain example.Com
    8·1 answer
  • Please help me please help me.​
    10·1 answer
  • If anyone wants to ft heres the link
    6·1 answer
  • How does an Ac Machine work
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!