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
11111nata11111 [884]
4 years ago
9

Write an algorithm for a method (say is Descending) that accepts an integer arrays (say A) as input parameter, and returns a boo

lean value true if the elements in the array are in descending order. Example 1: Formal Parameters: A = { 1, 2 , 3, 4 } Return : False Example 2: Give Formal Parameters: A = { 4, 3, 2, 1 } Return : True Example 3: Formal Parameters: A = { 4, 3 , 1, 2} Return : False
Computers and Technology
1 answer:
Neko [114]4 years ago
4 0

Answer:

Check the explanation

Explanation:

Algorithm for determining if the array passed as argument is in descending order or not.

1. Start

2. A = {1, 2, 3, 4};

3. Call function by passing array and it's size.

   isDescending(A, A.length);

4. Loop from 1 to size - 1 (inclusive)

5.     check if element at (i-1)th index is greater than element at (i)th index or not

6.     if at any point the above expression is executed to true value then return false

7.     if the above if statement is not executed then loop will terminate it self

8. Now return true.

// Java Implementation:

public static boolean isDescending(int[] arr, int size) {

   for (int i = 1; i < size; i++) {

       if (arr[i-1] > arr[i]) {

           return false;

       }

   }

   return true;

}

You might be interested in
I’m not very good at using word because this is my second time using it lol
Zolol [24]

Answer:

click outside of the square, to close the editing. then click where you need to type and it should let you type there.

5 0
3 years ago
Read 2 more answers
The purpose of the ________ element is used to configure the main content of a web page document.
Bingel [31]
The answer would be "Inspect"
4 0
3 years ago
For a horror film, Pauline wants to show a computer-generated monster appearing from the body of an actor. How can she do this?
mestny [16]

the  answer is option D

Explanation:

7 0
4 years ago
Which option is the default when creating appointments and meetings in a user’s own calendar as it relates to Free/Busy informat
Vlad1618 [11]

Answer:

C !

Explanation:

7 0
3 years ago
Choose the answer that best explains why Morse's invention of the telegraph changed media forever.
Alex73 [517]

Just had this question, the correct answer is

It was the first form of media that did not require people to physically transport the information.

7 0
3 years ago
Read 2 more answers
Other questions:
  • B. Find Addition of Binary Numbers: 1100112 + 11012
    11·1 answer
  • Is a factory-formatted hard disk split into a fixed number of files?
    14·1 answer
  • Three healthcare firms jointly own and share the same cloud resources to meet their computing needs. Which cloud model does this
    15·1 answer
  • All web traffic is based on the ____________________ protocol.
    14·1 answer
  • When executing System.out.println(a2), the toString() method in the Object class is invoked. The program cannot be compiled, bec
    11·1 answer
  • ASAP ε=ε=ᕕ(°□°)ᕗ<br> Sorry if you can't see it but please help me if you can!
    6·1 answer
  • A-1 grdening supply is preparing a reprt to hand out to the customerez in pointes form only.why should the reprts writers avoid
    9·2 answers
  • Define a class named person that contains two instance variables of type string that stores the first name and last name of a pe
    14·1 answer
  • Match each code snippet to its appropriate markup language name. XML CSS HTML XHTML<br><br><br>​
    10·1 answer
  • describe the impact of technology in your life . how does it affects your human relations with other people .​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!