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
shepuryov [24]
3 years ago
8

int foo(int A[], int left, int right){ int i, x, q, N; if(right <= left) return 1; x = 0; for(i=left; i <= right; i++) x +

= A[i] % 2; // busy work... N = right-left+1; q = left + (N/3); return x + foo(A, left, q) + foo(A, q+1, right);
Computers and Technology
1 answer:
sineoko [7]3 years ago
3 0

Answer:

quicksort.cpp

void quickSort(int arr[], int left, int right) {

     int i = left, j = right;

     int tmp;

     int pivot = arr[(left + right) / 2];

 

     /* partition */

     while (i <= j) {

           while (arr[i] < pivot)

                 i++;

           while (arr[j] > pivot)

                 j--;

           if (i <= j) {

                 tmp = arr[i];

                 arr[i] = arr[j];

                 arr[j] = tmp;

                 i++;

                 j--;

           }

     };

 

     /* recursion */

     if (left < j)

           quickSort(arr, left, j);

     if (i < right)

           quickSort(arr, i, right);

}

You might be interested in
What help in executing commands quickly
Sonbull [250]

Answer:99

Explanation:  Last summer, my family and I took a trip to Jamaica. My favorite part of the trip was when we went to a place called the Luminous Lagoon. We ate dinner and waited for the sun to go down. Then we boarded a boat and went out into the lagoon. That’s when the magic started.

At first we could not see very much in the darkness except for the stars in the sky. After a few minutes, however, I noticed some fish swimming in the water. They didn’t look like ordinary fish. These fish were glowing! Our guide explained that the glow came from tiny creatures in the water called dinoflagellates. These little animals are not visible to us, but their bodies produce light using something called bioluminescence, just like fireflies. There are so many of these creatures in Luminous Lagoon that the water around them seems to glow.

After our guide explained these facts to us, he told us to put our hands in the water. I was not sure if it would work, but I tried it. When I did, my hand looked like it belonged to a superhero! It was glowing bright blue. I hope someday I get to return to the Luminous Lagoon. The lights in the water were much more entertaining than the ones in the sky.

Problem:

audio

The Greek prefix dinos- means “whirling” and the Latin root word flagellum means “whip”. What does dinoflagellate most likely mean as it is used in the passage?

audio

the production of light from an organism’s body

audio

the study of creatures that live in the ocean

audio

to move around underwater water like a fish

audio

an organism with a whip-like part it uses to move around in the water

6 0
2 years ago
p25: File Write and Read1) User enters a file name (such as "myMovies.txt").2) User enters the titles of 4 of their favorite mov
SCORPION-xisa [38]

Answer:

<em>The program goes as follows  </em>

<em>Comments are used to explain difficult lines</em>

#include<iostream>

#include<fstream>

#include<sstream>

#include<string>

using namespace std;

int main()

{

//Declare String to accept file name

string nm;

//Prompt user for file name

cout<<"Enter File Name: ";

getline(cin,nm);

//Create File

ofstream Myfile(nm.c_str());

//Prompt user for 4 names of movies

string movie;

for(int i = 1;i<5;i++)

{

 cout<<"Please enter a movie title #"<<i<<": ";

 cin>>movie;

 //Write to file, the names of each movies

 Myfile<<movie<<endl;

}

Myfile.close(); // Close file

//Create an Array for four elements

string myArr[4];

//Prepare to read from file to array

ifstream file(nm.c_str());

//Open File

if(file.is_open())

{

 for(int i =0;i<4;i++)

 {

  //Read each line of the file to array (line by line)

  file>>myArr[i];

 }

}

file.close(); // Close file

//Create a reverseOrder.txt file

nm = "reverseOrder.txt";

//Prepare to read into file

ofstream Myfile2(nm.c_str());

for(int j = 3;j>=0;j--)

{

 //Read each line of the file to reverseOrder.txt (line by line)

 Myfile2<<myArr[j]<<endl;

}

Myfile2.close(); //Close File

return 0;

}

See attached for .cpp program file

Download cpp
6 0
3 years ago
python. create a program that asks the user to input their first name and their favorite number. Then the program should output
blondinia [14]

name = input("What is you name?")

fav_number = input("What is you favorite number?")

print(name + " your favorite number is " + fav_number + "!")

7 0
2 years ago
Why is it important to send a cover letter with a resume?
Novay_Z [31]
It's important to do so because you want to be sure it looks professional, just like it's important to add a cover to a report. It's also the first look at the resume and gives the overall look of it. It lets the job or employer know the specifics and into the resume talk more of what you do. It's like the overall information page..... Hope this helps. 
5 0
3 years ago
Read 2 more answers
Based on current and upcoming gaming technologies, what changes do you expect to see in the next generation of gaming consoles?
damaskus [11]
Better graphics getting 1080 p easily running on 240 frames and a higher storage so then you could have more games on the console
4 0
3 years ago
Other questions:
  • When you first open office calc, the most recently saved spreadsheet opens up. A) true B) false
    14·1 answer
  • A web __________, such as internet explorer or mozillaâs firefox, allow users to access the world wide web.
    10·1 answer
  • I'd like to edit a picture so that I can remove the background behind an object and have it replaced with a transparent backgrou
    13·2 answers
  • which of these describe raw data?check all of the boxes that apply A) what a person buys B) where a person lives C) data that ha
    9·1 answer
  • I have a question about a hotel tv: So I’ve brought my Nintendo Switch and my dock and plugged it in to the tv. Everything seems
    13·1 answer
  • Viết thuật toán, chương trình xử lý hạn chế trong việc xử lý số liệu phần nguyên để hiển thị lên lcd
    14·1 answer
  • Historically, storytelling passed down the most important ideas about life, family, and society from generation to generation; t
    10·2 answers
  • The Internet began when a large company wanted to sell products online.
    11·2 answers
  • 1. Which of the following is not true about high-level programming language s? (a) Easy to read and write (b) Popular among prog
    12·1 answer
  • Ema Company for business .
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!