subject

What are the Big-Oh and Tilde orders of the following code fragment? The fragment is parametrized on the variable n. Assume that you are measuring the number of swap calls. [10 points] public s tat ic void s o r t (Comparable [ ] a ) { int n = a . l eng th ; for ( int j = 0 ; j < n1; j++) { int z = j ; for ( int i = j +1; i < n ; i++) { i f ( a [ i ] < a [ z ] ) { z = i ; } } i f ( z != j ) { swap ( a [ j ] , a [ z ] ) ; // count t h e s e } } } (a) What is the Big-Oh order of the above code fragment? If it does not exist, then explain. (b) What is the Tilde order of the above code fragment? If it does not exist, then explain.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:30
Some of your friends have gotten into the burgeoning field of time-series data mining, in which one looks for patterns in sequences of events that occur over time. purchases at stock exchanges--what’s being bought-- are one source of data with a natural ordering in time. given a long sequence s of such events, your friends want an efficient way to detect certain "patterns" in them--for example, they may want to know if the four events buy yahoo, buy ebay, buy yahoo, buy oracle occur in this sequence s, in order but not necessarily consecutively. they begin with a collection of possible events (e.g., the possible’ transactions) and a sequence s of n of these events. a given event may occur multiple times in s (e.g., yahoo stock may be bought many times in a single sequence s). we will say that a sequence s’ is a subsequence of s if there is a way to delete certain of the events from s so that the remaining events, in order, are equal to the sequence s’. so, for example, the sequence of four events above is a subsequence of the sequence buy amazon, buy yahoo, buy ebay, buy yahoo, buy yahoo, buy oracle their goal is to be able to dream up short sequences and quickly detect whether they are subsequences of s. so this is the problem they pose to you: give an algorithm that takes two sequences of even~s--s’ of length m and s of length n, each possibly containing an event more than once--and decides in time o(m n) whether s’ is a subsequence of s
Answers: 2
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Technician a says that with self-adjusting clutch systems, the release bearing constantly rotates. technician b says that the ball bearing portion of the release bearing should be lubricated with high-temperature grease during routine maintenance. which technician is correct?
Answers: 2
question
Computers and Technology, 23.06.2019 21:40
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
Answers: 2
You know the right answer?
What are the Big-Oh and Tilde orders of the following code fragment? The fragment is parametrized on...
Questions
question
Biology, 15.11.2019 10:31
question
Social Studies, 15.11.2019 10:31
question
World Languages, 15.11.2019 10:31