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
marissa [1.9K]
2 years ago
7

You are given an array of integers, each with an unknown number of digits. You are also told the total number of digits of all t

he integers in the array is n. Provide an algorithm that will sort the array in O(n) time no matter how the digits are distributed among the elements in the array. (e.g. there might be one element with n digits, or n/2 elements with 2 digits, or the elements might be of all different lengths, etc. Be sure to justify in detail the run time of your algorithm.
Computers and Technology
1 answer:
Vlad [161]2 years ago
8 0

Answer:

Explanation:

Since all of the items in the array would be integers sorting them would not be a problem regardless of the difference in integers. O(n) time would be impossible unless the array is already sorted, otherwise, the best runtime we can hope for would be such a method like the one below with a runtime of O(n^2)

static void sortingMethod(int arr[], int n)  

   {  

       int x, y, temp;  

       boolean swapped;  

       for (x = 0; x < n - 1; x++)  

       {  

           swapped = false;  

           for (y = 0; y < n - x - 1; y++)  

           {  

               if (arr[y] > arr[y + 1])  

               {  

                   temp = arr[y];  

                   arr[y] = arr[y + 1];  

                   arr[y + 1] = temp;  

                   swapped = true;  

               }  

           }  

           if (swapped == false)  

               break;  

       }  

   }

You might be interested in
TASK 1. JUMBLE ME! Direction: Arrange the jumbled letters to form a word. 1. PEREAM 2. RRENT CU 3. METREMO H 4. TORSISER 5. TANC
ivanzaharov [21]

The Rearrangement of the words are:

  1. Ear map
  2. Rent cup
  3. METREON
  4. Sister or
  5. Sister Cane

<h3>What is arrangement of words?</h3>

A sorting method is known to be the orders of entries that are based on each word or phrase found in a heading, e.g. spaces, etc.

The Rearrangement of the words are:

  1. Ear map
  2. Rent cup
  3. METREON
  4. Sister or
  5. Sister Cane

Learn more about Arrangement from

brainly.com/question/984329

#SPJ1

6 0
1 year ago
Hey! I was recommended a site “9anime” the other day. All’s been going well but I accidentally taped on a new dub settingZ somet
Studentka2010 [4]

Answer:

yep defiantly virus

Explanation:

8 0
2 years ago
Read 2 more answers
Question 1
weeeeeb [17]

Answer:

-6.4

Explanation:

just divide -32 by 5 and you will get your answer of -6.4

7 0
3 years ago
You want to allow members of the users group to use fdisk on the /dev/sda drive (and only that drive) and to use the yum command
masya89 [10]

Answer:

su ,sg and sudo command.

Explanation:

Whenever the user needs to enable workgroup mates should use fdisk including just that disk on both the /dev / sda disk, using the following command to update and configure the following packages. Thus he uses the command su, sg, and sudo.

So, the following commands are required according to the following statement.

6 0
3 years ago
Linda is the education manager for a national coding service company. Once a month she holds a videoconference with all her codi
Andru [333]

Answer:

Option (D) i.e., synchronous is the correct option to the following question.

Explanation:

The following statement are the synchronous type of training because it is the type of training which is given to students or the persons for the purpose of knowledge in present time and the trainer or that person who give them information they can receive feedback and message at that time and all persons has permission to ask questions with them.

Option C is incorrect because in this type of training the interaction between the trainer and the receiver could not be established.

Option A is incorrect because the classroom-based training only for that person or the students who are available at that time at that place and in this video conferencing is not available.

8 0
3 years ago
Other questions:
  • What is the color difference between the iMac and iMac Pro
    14·2 answers
  • Which devices typically generate computer output ?
    8·2 answers
  • A(n) ____ string contacts the data source and establishes a connection with the database using the Data Source Configuration Wiz
    5·1 answer
  • 5. ADD A STATEMENT OR STATEMENTS to the program on the following page (including constant and/or variable declarations if you wa
    6·1 answer
  • . An access specifier is one of three keywords:
    14·1 answer
  • What does aperture control? A)amount of light the image sensor captures when taking a photo. B)how sensitive the camera is to in
    10·2 answers
  • AfcAAgrwdsgsFsefvzsdfvbjhbdjbbjbjsdndVHFadbhZJBVdb
    10·2 answers
  • Why is a Quality assurance tester needed on a software development team?
    5·1 answer
  • How does the issue of cybersecurity relate to the internet of things?.
    5·1 answer
  • How to get the lightning round in dares of eternity
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!