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]
3 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]3 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
NEED HELP ASAP
belka [17]

Answer:

Movie editing and Sound Editing

Explanation:

Gaming tool will not help edit video and audio that the production crew have shot. Media player will simply just play the video and not allow them to edit it. Animation tool isn't useful unless they plan on doing SFX.

8 0
3 years ago
Read 2 more answers
Skylar is viewing her personal and business calendar in a side-by-side fashion, but she would like to view a single calendar tha
pogonyaev

Answer:

The solution for the current situation in which Skylar is viewing her personal and business calendar in a side-by-side fashion, but she would like to view a single calendar that has appointments and meetings from both personal and business. is:

Configure the Overlay option.

Explanation:

The reasons behind this answer are that in the first place, creating another calendar is too much work. In the second place, the share of the calendars is not going to help her because that would only allow someone else to watch her calendars. However, using the overlay option will allow her to mix them and create one calendar with all her information.

8 0
3 years ago
A communications medium that carries a large amount of data at a fast speed is called
babymother [125]
Either Firewire, or an ethernet cable.
7 0
4 years ago
Can someone tell me how to fix the keyboard on ipad?- its in the middle of my screen andd i dont know how to do it
mamaluj [8]

Answer:

Here

Explanation:

To move keyboard to bottom of screen, you just need to tap and hold the keyboard icon at the bottom-right corner of the keyboard, choose Dock option. To fix iPad keyboard in middle of screen, please tap and hold the keyboard icon, then choose Dock.Nov 5, 2020

5 0
3 years ago
How a student can use computer to improve academic performance?
nikdorinn [45]

Answer:

k Nishant

Explanation:

he can learn many things internet by using computer he change his self by learning about many things

3 0
3 years ago
Read 2 more answers
Other questions:
  • In Microsoft Word you can access the _______ command from the "Mini toolbar".
    9·1 answer
  • What contains the computer brain the central processing unit
    8·2 answers
  • Trojan Horse is a malicious program and a virus is a program. <br><br> a. True <br> b. False
    6·1 answer
  • Write a function to output an array of ints on a single line. Funtion Should take an array and an array length and return a void
    9·1 answer
  • Write a routine to interchange the mth and nth elements of a singly-linked list. You may assume that the ranks m and n are passe
    10·1 answer
  • Which century saw the development of letterpress printing?
    10·1 answer
  • PLS REPLY ASAP WILL MARK BRAINLIEST
    5·2 answers
  • Leslie works in an SDLC team. When Leslie edits a file, it gets saved as an altered version. Later all the altered versions are
    9·1 answer
  • 3 ways that can be used to connect computers to a network
    5·1 answer
  • Who are all the fnaf characters?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!