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
Computer-based networks that trigger actions by sensing changes in the real or digital world are known as: global marketing plat
Gennadij [26K]
It known as the smart systems

It make decision by describing and analyzing the available data in a predictive or adaptive manner thereby performing an efficient and smart actions based on that analysis

A lot of smart systems evolved from micro systems
8 0
3 years ago
What stage of software development incorporates planning to help make changes in the project plan based of reviews
larisa86 [58]

Answer:

A

Explanation:

8 0
3 years ago
Riodic Table
Ksenya-84 [330]

Answer:

riodic Table

A museum wants to store their valuable documents in cases that contain a gas that will protect the documents.

She should not choose one of the other gases because they are too

The museum director should choose

Explanation:

I didn't understand

8 0
3 years ago
5. How is shutter speed generally measured? What do the measurements mean?
Leokris [45]
Shutter speed<span> is </span>generally measured<span> by the scientific symbol “s”. The </span>measurement means<span> that the </span>measurements<span> in "s" is the reciprocal of the number when the denominator is put on the numerator side instead. ... Aperture is </span>measured<span> by f's.</span>
6 0
3 years ago
Read 2 more answers
Microsoft word's spelling checker will offer suggestions on misspelled words.<br> True)<br> False)
Rasek [7]
This is true. I hope I was helpful!
7 0
3 years ago
Read 2 more answers
Other questions:
  • Coloumn1; Criteria1: Average of best three marks (CA); CA&gt;=40
    13·1 answer
  • If you are trying move a hard drive from a non-working computer to a working computer for the purposes of accessing the data on
    5·1 answer
  • In the context of Information Technology Infrastructure Library, _____ delivers information technology IT services on an ongoing
    14·1 answer
  • Select the correct answer from each drop-down menu.
    6·1 answer
  • Given the following while() loop, which statement is true assuming A,B,C,D are int variables and A &gt; B? while ( ( A &gt;= B)
    8·1 answer
  • What tasks should a laptop accomplish?
    15·1 answer
  • Question 2 of 3
    7·2 answers
  • Rosa is building a website for a multimedia company. She wants to add a drop-down menu functionality to the website's main page.
    12·1 answer
  • Explain why agile methods may not work well in organizations that have teams with a wide range of skills and abilities and well-
    7·1 answer
  • Extend the class linkedListType by adding the following operations: Write a function that returns the info of the kth element of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!