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
GenaCL600 [577]
3 years ago
9

. Consider the problem of finding the largest element in a list of n elements. What will be the basic operation of an algorithm

to solve this problem?
assignment

addition

looping

comparesn
Computers and Technology
1 answer:
natali 33 [55]3 years ago
4 0

Answer:

Comparison.

Explanation:

When we have to find a largest in a list of n elements.First we have to iterate over the list so we can access all the elements of the list in one go.Then to find the largest element in the list we have to initialize a variable outside the loop with the minimum value possible and in the loop compare each element with this value,if the element is greater than the variable assign the element to the variable.Then the loop will find the largest element and it will be the variable.

You might be interested in
When would a one way flag variable be used
Tamiku [17]
A one-way flag<span> can also be </span>used<span>, for example, to watch errors occuring in input data so that the program </span>could<span> ask the inputs again. A </span>variable<span> is a temporary if its value is always needed only for a very short period.</span>
7 0
3 years ago
c++ Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value is c
Ksivusya [100]

<u>Answer:</u>

<em>int fNumber,scndNumber = -1,  </em>

<em>dup = 0; </em>

<em>do { </em>

<em>cin >> fNumber; </em>

<em>if ( scndNumber == -1) { </em>

<em>scndNumber = fNumber; </em>

<em>} </em>

<em>else { </em>

<em>if ( scndNumber == fNumber ) </em>

<em>duplicates++; </em>

<em>else </em>

<em>scndNumber = fNumber; </em>

<em>} </em>

<em>} while(fNumber > 0 );  </em>

<em>cout << dup; </em>

<u>Explanation:</u>

Here three variables are declared to hold the first number which is used obtain all the inputs given by the user, second number to hold the value of <em>last encountered number and “dup” variable to count the number of duplicate values.</em>

<em>“Do-while”</em> loop help us to get the input check whether it is same as previous input if yes then it <em>adds to the duplicate</em> value otherwise the new previous value if stored.

4 0
2 years ago
Read 2 more answers
Write the code to call the function named send_signal. there are no parameters for this function.
nikklg [1K]

<em>*Assuming JavaScript</em>

Answer:

function send_signal() {}

send_signal() // calls the function

Explanation:

3 0
2 years ago
On a router configured to use RIP, the number of routers a packet must travel between before it reaches its destination is calle
11111nata11111 [884]

Answer:

metric

hop count

Explanation:

6 0
3 years ago
A) Write a class Card. A Card has the following private attributes:
Over [174]

Answer:

Java.

Explanation:

public class Card

{

   String Suit;

   int value;

   public Card(int value, String Suit) {

       self.value = value;

       // Check Suits value

       if ((Suit == "hearts") || (Suit == "spades") || (Suit == "clubs") || (Suit == "diamonds"))

           self.Suit = Suit;

       else {

           Suit = "none";

           throw new IllegalArgumentException("no card of this type exists.");  

        }

   }

   public String getSuit() {

       return Suit;

   }

   public int getValue() {

       return value;

   }

 

   public void print() {

       System.out.println("%d of %s", value, Suit);

   }

}

public class Deck {

}

6 0
2 years ago
Other questions:
  • Consider the following method: public static void arrayMystery(int[] array) { for (int i = 0; i &lt; array.length - 1; i++) { if
    10·1 answer
  • Given that the array monthSales of integers has already been declared and that its elements contain sales data for the 12 months
    6·1 answer
  • List 5 anti-virus products currently in use
    15·1 answer
  • One advantage of using a security management firm for security monitoring is that it has a high level of expertise.
    15·2 answers
  • The fraction 460/7 is closest to which of the following whole numbers?
    11·1 answer
  • Which questions should you ask yourself when performing research online?
    9·1 answer
  • Wrtie a program in which we will pass a value N. N can be positive or negative. If N is positive then output all values from N d
    8·1 answer
  • What will the declaration below do to its target?
    9·1 answer
  • Assume that the message M has to be transmitted. Given the generator function G for the CRC scheme, calculate CRC. What will be
    15·1 answer
  • At a red traffic light, you must stop__
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!