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
erastova [34]
2 years ago
14

Use appropriate method calls from the List ADT to create the following list:

Computers and Technology
1 answer:
Mumz [18]2 years ago
7 0

Answer:

The complete method is as follows:

public List buildList(List L) {  

 L.insert(30);

 L.insert(23);

 L.insert(19);

 L.insert(4);  

   return L; }

Explanation:

To complete the method, we make use of the insert() function.

This inserts elements of the list into list L. However, we have to start from the last element (i.e. in descending order)

So, the explanation is as follows:

 

 L.insert(30); --- This inserts the last element

Continue inserting in descending order

<em>  L.insert(23);  </em>

<em>  L.insert(19); </em>

Until the first list element is inserted

 L.insert(4);

This returns the filled list L  

   return L;

You might be interested in
Recall the problem of finding the number of inversions. As in the text, we are given a sequence of n numbers a1, . . . , an, whi
Kay [80]

Answer:

The algorithm is very similar to the algorithm of counting inversions. The only change is that here we separate the counting of significant inversions from the merge-sort process.

Algorithm:

Let A = (a1, a2, . . . , an).

Function CountSigInv(A[1...n])

if n = 1 return 0; //base case

Let L := A[1...floor(n/2)]; // Get the first half of A

Let R := A[floor(n/2)+1...n]; // Get the second half of A

//Recurse on L. Return B, the sorted L,

//and x, the number of significant inversions in $L$

Let B, x := CountSigInv(L);

Let C, y := CountSigInv(R); //Do the counting of significant split inversions

Let i := 1;

Let j := 1;

Let z := 0;

// to count the number of significant split inversions while(i <= length(B) and j <= length(C)) if(B[i] > 2*C[j]) z += length(B)-i+1; j += 1; else i += 1;

//the normal merge-sort process i := 1; j := 1;

//the sorted A to be output Let D[1...n] be an array of length n, and every entry is initialized with 0; for k = 1 to n if B[i] < C[j] D[k] = B[i]; i += 1; else D[k] = C[j]; j += 1; return D, (x + y + z);

Runtime Analysis: At each level, both the counting of significant split inversions and the normal merge-sort process take O(n) time, because we take a linear scan in both cases. Also, at each level, we break the problem into two subproblems and the size of each subproblem is n/2. Hence, the recurrence relation is T(n) = 2T(n/2) + O(n). So in total, the time complexity is O(n log n).

Explanation:

5 0
3 years ago
Who is he can anyone help me​
34kurt
This person is Elon Musk, the owner of Tesla :)
5 0
2 years ago
Read 2 more answers
A public Wi-Fi risk that can be minimized by only visiting
lord [1]

Answer

it is B

Explanation:

because i had the test and i picked that

6 0
3 years ago
Which one of the following features can control left and right indents on using markers
QveST [7]
The Feature that can control left and right indents on using markers is Ruler.  The indent marker consists of two triangles and a rectangle.  <span>To change the left indent, click on the very bottom of the indent marker, the rectangle, and drag it to a new position.</span>  <span>The Right Indent is indicated by a single triangle on the Ruler at the current right margin. Click and drag it to change the margin.</span>
3 0
3 years ago
1. Engineers should not consult with experts if they do not know much about a problem.
Ganezh [65]
1. false
2. d
3. b
4. a
5. b
6.c
7. b
8.a
9. d
10. b
11. d
12.a 
13. c
14. c
15. a
5 0
3 years ago
Other questions:
  • Question 1 of 20 :
    15·2 answers
  • When an object is selected, it is surrounded by ________, which allow you to change the size of the object.?
    5·1 answer
  • 1. Mobile devices have a _________ viewport that displays a web page content that fits within a mobile screen.
    11·1 answer
  • A Unit of information containing the objects position, rotation, and scale values is called:
    13·1 answer
  • Select the layer of the OSI model that is responsible for reformatting, compressing, and/or encrypting data in a way that the ap
    14·1 answer
  • Which osi/iso layer is responsible for determining the best route for data to be transferred?
    5·1 answer
  • Your organization uses a type of cryptography that provides good security but uses smaller key sizes and utilizes logarithms tha
    9·1 answer
  • how does a demilitarized zone (dmz) work. A.By preventing a private network from sending malicious traffic to external networks
    10·1 answer
  • Generalized goals are more likely to be achieved than specific goals. True or False
    7·1 answer
  • How to implement switch statement in Python?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!