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
astraxan [27]
3 years ago
10

Assume you have a sorting algorithm that you can use as a black box. Use the sorting algorithm to sort the input list. Now write

an algorithm to count the number of duplicates again. Analyze the time complexity of your algorithm in the worst-case (ignore the time complexity of sorting). Could you improve the worst-case time complexity of your algorithm compared to the previous question
Computers and Technology
1 answer:
Ber [7]3 years ago
7 0

Answer:

Algorithm explained below

Explanation:

Algorithm to check duplicate when list of element is sorted:

CheckDuplicate( Sorted list )

    initialize count = 0

    Repeat untill we reach on end of list :

            if next is not end of list and current element is equal to next element

                    count = count+1

                    increase the pointer to next untill a different element is found

end CheckDuplicate

Worst Case Time Complexity will be O(n). Because there is only one iteration over the list will be performed.

Yes We have improved the worst case time complexity compared to previous question.

Actually after applying sorting all the similar element to will be next to each other.Then we will start iterating one by one from one side and check which is similar to next.If a different element will be find then we will check whether it's next is similar to it or not.

eg. 1 1 1 2 2 2 4 4 4 we can check duplicate in one iteration.

You might be interested in
We have the following class:
maxonik [38]

Answer:

The correct answer is d) Banana co;

Explanation:

In Java everything is an object, for example when we declare a variable x of type int we usually do in this way, determine the class we are going to instance and then the name of our object:

  • int <em>x</em>;

On the example  above we instantiate an object of int named x.

For this exercise we have to instantiate an object of type Banana that is going to be named co.

  • Banana <em>co</em>;
3 0
4 years ago
Is there a way to search your computer for all music files on it?
Slav-nsk [51]
Yes their is a way go to your downloads see if you have some thing or their shall be something that you can type in your computer and find something or you can go to Youtube or google and they can show you a video or some articles.
5 0
4 years ago
Which statement is an example of an opinion from an online source?
Ray Of Light [21]

Answer:

Maya angelou is one of the greatest american poets.

Explanation:

Its an opinion.

4 0
3 years ago
Read 2 more answers
Digital information is stored using a series of ones and zeros. Computers are digital machines because they can only read inform
Elan Coil [88]
This is the binary system. Numbers are easily translated from binary simply by each binary number in a bit of information has an exponential value. You can translate binary to words because each set of 8 0s and 1s can be translated into numbers which are labeled in a system called asscii. For each number there is a charecter or symbol associated. for example:0000 0011 would translate to 3 and in asscii that 3 would translate into a G. therefore 00000011 would be translated twice by the computer if you hit the g key on your keyboard until a G was displayed on your screen.
4 0
3 years ago
Universal Containers wants line items to be organized into pre-defined groups on the output document. The name of these pre-defi
Vsevolod [243]

Answer:

C. Set the Group Filed field on the Quote Template or Template Section records.

D. Set the New Quote Group field on each Product record with the associated group name.

Explanation:

There are two ways through administrator can organized into pre-defined groups on the output document and name of these pre-defined groups needs to be displayed above each group in the output to identify it.

Both of the ways are given in option "C" and "D".

1. We set the group field on the quote template to organize the groups in pre-defined order on the output.

2. We also set the New Quote Group field on each Product record with the associated group name to display the name on each group in the output to identify it.

6 0
4 years ago
Other questions:
  • Which version represents the video project after the assembly cut has been completed, transitions and special effects have been
    9·1 answer
  • 535 = d +4<br> Whats d?????????????????????<br> &lt;33 thnx babes.
    8·2 answers
  • A small company connects data acquisition equipment to the serial port of a computer. The equipment user has reported that not a
    8·1 answer
  • Identify four basic data manipulations performed on a relational database using sql
    7·1 answer
  • A Windows user has been successfully saving documents to the file server all morning. However, the latest attempt resulted in th
    9·2 answers
  • The term Electronic Privacy Information Center (EPIC) refers to a form of the digital subscriber line technology, which enables
    6·1 answer
  • DRU is a small brokerage house that enables its clients to buy and sell stocks over the Internet, as well as place traditional o
    14·1 answer
  • Write a program that creates a Date object, sets its elapsed time to 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10
    9·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    7·2 answers
  • It is where the home tab is located where you can view all the all the formatting purpose <br>​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!