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
miss Akunina [59]
2 years ago
13

Write a recursive function that returns 1 if an array of size n is in sorted order and 0 otherwise. Note: If array a stores 3, 6

, 7, 7, 12, then isSorted(a, 5) should return 1 . If array b stores 3, 4, 9, 8, then isSorted(b, 4) should return 0.
Computers and Technology
1 answer:
galina1969 [7]2 years ago
6 0

Answer:

The function in C++ is as follows:

int isSorted(int ar[], int n){

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

 return 1;}

if (ar[n - 1] < ar[n - 2]){

 return 0;}

return isSorted(ar, n - 1);}

Explanation:

This defines the function

int isSorted(int ar[], int n){

This represents the base case; n = 1 or 0 will return 1 (i.e. the array is sorted)

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

 return 1;}

This checks if the current element is less than the previous array element; If yes, the array is not sorted

if (ar[n - 1] < ar[n - 2]){

 return 0;}

This calls the function, recursively

return isSorted(ar, n - 1);

}

You might be interested in
The 6 steps for PowerPoint competency from the TED talk in the module "How to Avoid Death by PowerPoint."?
KIM [24]

Answer:

1. Do some presentation preparation work

2. Set the right tone and end on a high note.

3. Create sleek and stylish slides.

4. Get your audience to focus.

5. Its all about you.

Explanation:

1. Do some presentation preparation work:

A good presentation begins, not with slides, but with a pencil and paper. Research your audience’s background, interests and capabilities. What do they already know, for instance, and what can they learn from you?

2. Set the right tone and end on a high note:

You have no more than 30 seconds to secure your audience’s attention. So, what attention-grabbing opener will you use?

Visual communications expert Curtis Newbold suggests “a fascinating quote; an alarming or surprising statistic; asking your audience a question; telling a relevant and funny joke… an imaginary scenario; or a demonstration''.

3. Create sleek and stylish slides:

Once you have your story down, you can start to design your slides.  

Before you do, it’s important to think about the practicalities. Will they, for instance, be displayed Widescreen with a 16:9 ratio? Or Standard with 4:3? This might seem like a small detail, but it can make a huge difference in terms of visual impact.

4.  Get your audience to focus:

The most important thing is to grab your audience’s attention straight away – and then maintain it! You want your audience to go away having learned something. So, make it as easy as possible for people to grasp your message “from the off”!

5.  Its all about you:

Finally, remember that, ultimately, it’s you that the audience should be paying attention to, not your slides!

PowerPoint can be used to create great visual aids, but the success of your presentation is determined by the way you deliver them. So, tell your story with a confident, compelling physical presence, and master it by rehearsing it 10 to 15 times.

6 0
3 years ago
Which component is most likely to allow physical and virtual machines to communicate with each other?
Diano4ka-milaya [45]

A component which is most likely to allow both physical and virtual machines to communicate with each other is a: virtual switch.

<h3>What is virtualization?</h3>

Virtualization can be defined as the creation of an abstract layer over computer hardware primarily through the use of a software, in order to enable the operating system (OS), storage device, server, etc., to be used by end users over the Internet.

In Cloud computing, some of the components (features) which is not required for a successful virtualization environment include the following:

  • Virtual machine
  • Host machine
  • Hypervisors

In conclusion, we can infer and logically deduce that a component which is most likely to allow both physical and virtual machines to communicate with each other is a virtual switch because it enables the virtual servers and the desktops to communicate.

Read more on virtualization here: brainly.com/question/14229248

#SPJ1

Complete Question:

Which component is most likely to allow physical and virtual machines to communicate with each other?

VHD.

Virtual switch.

Hyper V.

Host OS.

8 0
1 year ago
Explain the following terms as used in word processin
meriva

Answer:

A drop cap (dropped capital) is a large capital letter used as a decorative element at the beginning of a paragraph or section. The size of a drop cap is usually two or more lines.

a superscript is a character(s) half the height of a standard character and printed higher than the rest of the text.

In word processing, the word indent is used to describe the distance, or number of blank spaces used to separate a paragraph from the left or right margins.

6 0
2 years ago
1. You have a light in your living room that you can turn on or off from either (A) the living room, or (B) the kitchen.
Ksenya-84 [330]

Answer:

Table lamps or floor lamps with an adjustable head are the ideal fixtures for providing task lighting in living rooms.

Explanation:

3 0
2 years ago
Your database was damaged due to hardware failure. What can you use to restore it?
vesna_86 [32]
The only way is if you have backed up everything! Computers are amazing but they don't know that you need to back up your info. You should back up everything regularly! 
Hope this helped and have a nice day!

8 0
3 years ago
Other questions:
  • What happens if you give false information on your driver license application?
    12·1 answer
  • write an algorithm that gets the price for item A plus the quantity purchased. The algorithm prints the total cost, including a
    5·1 answer
  • Which of the following is NOT areserved word in Java?intpublicstaticnum
    9·1 answer
  • List the difference between GIGO and bug ​
    15·1 answer
  • 50 POINTS How do you express yourself and your creativity through computer science?
    12·1 answer
  • What is 4x+2x(-3-3) thanku
    11·2 answers
  • If AL contains binary 1000 1111, which one will show the information of the binary bits in AL after performing operation SHR AL,
    8·1 answer
  • Robyn needs to ensure that a command she frequently uses is added to the Quick Access toolbar. This command is not found in the
    11·1 answer
  • In the year, , the American Department of Defense put a military research network, called ARPANET online.
    5·1 answer
  • Why womt this code work????
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!