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
fomenos
3 years ago
12

We can sort a given set of n numbers by first building a binary search tree containing these numbers (using Tree-Insert repeated

ly to insert the numbers one by one) and then printing the numbers by an inorder tree walk. What are the worst-case and best-case running times for this sorting algorithm?

Computers and Technology
1 answer:
OLga [1]3 years ago
5 0

Worst case for binary search tree -O(n)

Best case for binary search tree -O(1)

<u>Explanation:</u>

The Binary search tree is the special type of binary tree. There are two child node

  1. Left child node
  2. Right child node  
  • In that, the right child node has a value greater than it’s the parent node. The left child node has value less than it’s the parent node.
  • In the below fig. for inserting element 0, it must be inserted as the left child of 1. Therefore, for sorting we have traveled in reverse order from (3,2,1) this is the worst-case complexity O(n).

You might be interested in
Output a table that show the cube of the numbers 1-15<br> (C++)
Rainbow [258]

Answer:

The c++ program to display cube of numbers from 1 to 15 is given below.

#include <iostream>

using namespace std;

int main() {    

   // variables declared and initialized  

   int num = 15, k, cube;    

   cout << " Cubes of numbers from 1 to 15 are shown below " << endl;    

   for( k = 1; k <= num; k++ )

   {

       // cube is calculated for each value of k and displayed

       cube = k * k * k ;

       cout << " \t " << cube << endl;

   }

return 0;

}

 

OUTPUT

Cubes of numbers from 1 to 15 are shown below  

  1

  8

  27

  64

  125

  216

  343

  512

  729

  1000

  1331

  1728

  2197

  2744

  3375

Explanation:

The variables are declared and initialized for loop, cube and for condition in the loop – k, cube, num respectively.

Inside for loop which executes over k, beginning from 1 to 15, cube of each value of k is calculated and displayed. The loop executes 15 times. Hence, cube for numbers from 1 to 15 is displayed after it is calculated.

   for( k = 1; k <= num; k++ )

   {

      cube = k * k * k ;

       cout << " \t " << cube << endl;

   }

In the first execution of the loop, k is initialized to 1 and variable cube contains cube of 1. Hence, 1 is displayed on the screen.

In the second execution, k is incremented by 1 and holds the value 2. The variable cube contains cube of 2, which is calculated, and 8 gets displayed on the screen.

After each execution of the loop, value of k is incremented.

After 15 executions, value of k is incremented by 1 and k holds the value 16. This new value is greater than num. Hence, the loop terminates.

3 0
3 years ago
Spyware is unwanted and often unsolicited messages. It is not technically malicious software, but can have a serious negative ef
o-na [289]

Answer:

The answer is "Option b".

Explanation:

The given statement is false because the spyware is a malicious program, that infects its device, and steals access to systems data from its web, and the spam also isn't technically malicious, but it could have a serious negative impact through density on the networks, and it is also junk message, which is web slang for an email message, which is primarily unsolicited email.

4 0
3 years ago
Choose the best function for the purpose. You need a collection to grow. Once you have all the data values, you will pass the co
bonufazy [111]

Answer:

Static function I think

Explanation:

7 0
3 years ago
Read 2 more answers
. What are the things that we need to consider to have a good quality in oil painting using photoshop?​
saw5 [17]

Answer:

The main advantages of oil paints are their flexibility and depth of colour. They can be applied in many different ways, from thin glazes diluted with turpentine to dense thick impasto. Because it is slow to dry, artists can continue working the paint for much longer than other types of paint.

Explanation:

if your trying to photo shop I would try to blend asuch as you can

6 0
2 years ago
Select all functions of utilities.
vivado [14]

Answer:

provides an easy way for workers to interact with their computers

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • )1-bit sign, 8-bit exponent, 23-bit fraction and a bias of127 is used for ___________ Binary Floating PointRepresentation
    11·1 answer
  • video-sharing sotes such as youtube and vimeo provide a place to post short videos called clips true or false?
    5·1 answer
  • Why is outfitting a workspace with video games in technology development company considered a strategic use of money
    8·2 answers
  • ____ of risk is the choice to do nothing to protect an information asset and to accept the outcome of its potential exploitation
    14·1 answer
  • What is the lowest layer of the OSI model at which LANs and WANs support the same protocols?
    5·1 answer
  • Write a program to display the roll number of students who have scored 100 in math. display appropriate message if none have sco
    5·1 answer
  • Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional
    6·2 answers
  • Need help with python coding
    12·2 answers
  • Wilt short answer of the fol<br>What is an operating systeme te ay maglia<br>​
    12·1 answer
  • In the 1760s and early 1770s, the British government wanted to raise money by taxing the residents of its colonies in North Amer
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!