How many elements in the matching index of the other list

Assignment Help Computer Engineering
Reference no: EM132095885

PLease help You need this in java please also explain what how the comparable interface works and also how a compareTo method works

Have the AList class implement the Comparable interface. Write the compareTo method to order lists this way:

First by size: a list that has fewer elements is smaller

Second, if the lists have the same number of elements: order by how many elements in the matching index of the other list are smaller; the list with more smaller elements in the matching position is smaller (see the examples below)

Note, to test your AList class, use these class and method headers:

public class AList<T extends Comparable> implements ListInterface<T>, Comparable<AList<T>>

public int compareTo(AList<T> otherList)

You also need to change the lines in the constructor and toArray methods from using Object to using Comparable:

T[] tempList = (T[]) new Comparable[initialCapacity + 1];

T[] result = (T[]) new Comparable[numberOfEntries]; // Unchecked cast

Example:

List A: 1, 5, 6, 8, 10

List B: 2, 4, 3, 9, 7

In this example, List B is smaller because 3/5 elements in List B are less than their matching element in List A (4 < 5, 3 < 6, and 7 < 10).

List A: 1, 3, 5, 7, 10

List B: 2, 4, 3, 9, 7

In this example, List A is smaller because 3/5 elements in List A are less than their matching element in List B 1 < 2, 3 < 4, and 7 < 9).

List A: 1, 2, 3, 10, 9

List B: 2, 4, 3, 9, 7

In this example, neither is smaller because each has 2/5 elements smaller than their matching element in the other list.

Reference no: EM132095885

Questions Cloud

Example of decision making under certainty : Is the transportation method an example of decision making under certainty or decision making under uncertainty?
Was there an enforceable contact here : 1. Was there an enforceable contact here? Will Jamal be required to pay the extra $600 and if so, on what grounds?
Create a functional traffic light with oval shapes : Create a functional traffic light with oval shapes in visual basic, without using the powerpack to create the shapes.
Elements of the applied creativity-innovation model : There isn't any fixed number of words but it's more important to include all the 5 elements of the Applied Creativity & Innovation model.
How many elements in the matching index of the other list : If the lists have the same number of elements: order by how many elements in the matching index of the other list are smaller;
Evaluate the opportunities and threats that exist : The next stage of the marketing audit is for you to consider the market for your organisation and evaluate the opportunities and threats that exist
Write the method called stringsletters : Write the method called Strings.letters(String str) that returns a string of letters that only occur once in str, in the same order that they appear.
Write a program that gets ints from a file : Write a program that gets ints from a file. These are numerators and denominators, and you are to create Fractions.
A paint calculator that gives the customer the area : Create a CustomerData.txt file with 10 Customers including Customers Name, Room Name, Length of the Room, Width of the room and Height of the room.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Hokusai - sketching streams in real time

You will implement and experiment with several algorithms to approximate historical item counts in a space-efficient manner.

  The presentation of web site or the content

What are the good and useful features and presentation of a web site that you look for.

  Name the units of absorptivity

Name the Units of absorptivity if it has any units.

  Discuss the cpm marketplace over the last couple of years

What are some of the major acquisitions that have occurred in the CPM marketplace over the last couple of years

  Methodology of information systems security penetration

Red Teaming COLLAPSE In today's cyber threat environment it is not possible to add enough controls to eliminate all system vulnerabilities.

  How many times does the top module call each subordinate

What tool would not be useful in preparing a Module Specification for a programmer to code the Update Account Module?

  What are some of the more popular exception handling uses

Exception Handling in Java is a very powerful capability. Exception Handling allows us to check input, verify if files exist, precent division by zero, prevent array out of bounds, and a whole host of other things.

  Prepare a workflow diagram to describe how analytics and

write a four to six 4-6 page design document in which yousupport the need for the use of analytics and cloud technology

  Create a one-page document detailing the actions required

Create a 1-page document detailing the actions required to configure VPN, routing, and direct access services in Windows Server 2012 R2 to give buyers remote.

  Give the assembly language code of microcontroller

For each of the logic statements, give the assembly language code of your microcontroller to set the condition code register and to branch to the ELSE.

  Design the created cell.

design a 2x2 cell array A with the following elements: 4x4 identity matrix; the string 'London is the largest city in world', the complex number (3+i*10); the array of N=20 numbers (of type single) representing the geometric progression with the b..

  Discuss link state and distance vector routing types

Write essay on several examples of link state and distance vector routing types

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd