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
Crank
3 years ago
14

A binary search algorithm is written (as in the modules, for example) which searches a pre-sorted array for some user-defined va

lue, clientData. If clientData is stored in the array, it returns its array position, and if not found, it returns -1 (again, just like in the modules). Assume the array to be searched has 100 data elements in it. (Check all that apply):[NOTE: due to common off-by-one interpretations when counting such things, if your predicted answer is within one (+1 or -1) of a posted option below, you can assume your prediction and the choice you are looking at are equivalent and check that option.]A. It might return to the client with an answer after only one comparison of data.B. It may require as many as 99 comparisons of data before it returns.C. It will always return with an answer in 7 or fewer comparisons of data.D. It will always return with an answer in 3 or fewer comparisons of data.
Computers and Technology
1 answer:
Mazyrski [523]3 years ago
4 0

Answer:

c) it will always return with an answer of 7 or fewer comparisons of data.

Explanation:

As maximum number of comparison in worst case for sorted binary search is log₂n, here n = 100, so maximum search is at least 6.6 which is approximately 7.

You might be interested in
Validating the users claimed identity is called which of the following?A. AuthenticationB. IdentificationC. VerificationD. Valid
soldier1979 [14.2K]

Answer:Authentication

Explanation:

3 0
4 years ago
A file with a .bat file extension is called a batch file. You can use a batch file to execute a group of commands, sometimes cal
Elan Coil [88]

Answer:

Create a text file. And add this code in it:

@echo off

You are welcome to the batch programming!

And now save it with .bat file type. Give it any name you want.

And to run the bat file, double click the bat file. It will be running.

You can run it from command prompt as well. Type as below:

C:\folder\batch_name.bat.

Now, we can add as many commands in the file as we want, and we can do the batch programming.

Explanation:

Please check the answer section.

8 0
3 years ago
The Account class contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and a
melamori03 [73]

Answer:

I've updated the Account class as per the instructions. The instructions mention "the constructor for this class creates a random account number" although I didn't find where that was. As a result, I created a simple method to generates the account number (located at the bottom of the class). Be sure you understand the changes (highlighted in yellow) and feel free to ask follow-up questions:

Explanation:

//*******************************************************

// Account.java

//

// A bank account class with methods to deposit to, withdraw from,

// change the name on, and get a String representation

// of the account.

//*******************************************************

import java.util.Random;   // Used for Random # generator

public class Account

{

      private double balance;

  private String name;

     private long acctNum;

      //----------------------------------------------

 //Constructor -- initializes balance, owner, and account number

  //----------------------------------------------

 public Account(double initBal, String owner, long number)

{

        balance = initBal;

               name = owner;

            acctNum = number;

}

// !!!!!! New Constructor !!!!!!

public Account(double initBal, String owner)

     {

        balance = initBal;

               name = owner;

            acctNum = generateAccountNumber();

       }

  // !!!!!! New Constructor !!!!!!

 public Account(String owner)

     {

        balance = 0;

             name = owner;

            acctNum = generateAccountNumber();

       }

   //----------------------------------------------

 // Checks to see if balance is sufficient for withdrawal.

// If so, decrements balance by amount; if not, prints message.

  //----------------------------------------------

 public void withdraw(double amount)

      {

        if (balance >= amount)

                balance -= amount;

               else

                     System.out.println("Insufficient funds");

}

 // !!!!!! New withdraw() method !!!!!!

   public void withdraw(double amount, double fee)

  {

        double amountWithFee = amount + fee;

               if (balance >= amountWithFee)

                 balance -= amountWithFee;

        else

                     System.out.println("Insufficient funds");

}

   //----------------------------------------------

 // Adds deposit amount to balance.

       //----------------------------------------------

 public void deposit(double amount)

       {

        balance += amount;

       }

  //----------------------------------------------

 // Returns balance.

      //----------------------------------------------

 public double getBalance()

       {

        return balance;

  }

    //----------------------------------------------

 // Returns a string containing the name, account number, and balance.

    //----------------------------------------------

 public String toString()

 {

        return "Name:" + name +

          "\nAccount Number: " + acctNum +

         "\nBalance: " + balance;

 }

 // !!!! NEW PRIVATE HELPER METHOD TO GENERATE ACCOUNT NUMBERS !!!!!

//-------------------------------------------------------

// Returns a random account number between 10000 - 99999

 //--------------------------------------------------------

       private long generateAccountNumber()

     {

        Random r = new Random();        // Seed the random number genertor with the system time

         return 10000 + r.nextInt(89999);        // .nextInt(89999) will return a value between 0 and 89999)

      }

}

8 0
4 years ago
To carry computer data over the long haul, wans need to have a(n) ________ in multiple towns and cities.
nika2105 [10]
<span>To carry computer data over the long haul, wan need to have a </span>POP (point of presence) <span>in multiple towns and cities. It is a</span><span>n artificial demarcation point OR interface point between communicating entities</span>


3 0
4 years ago
Set of general format used to write program in any programming language?​
Pavlova-9 [17]
I think It might be Algorithms , algorithmic are a set of instructions that are used to solve a certain problem which of we create many programs…etc
4 0
3 years ago
Other questions:
  • Hands-on Assignment To these assignments, refer to the tables in the JustLee Books database. Generate and test two SQL queries f
    10·1 answer
  • Two good guidelines for good readability on a website are ______ (choose two)
    14·1 answer
  • What is the purpose of citations?
    13·1 answer
  • The UNIX system does not attempt to avoid cycles. Instead, it restricts access to the linking capability of the system. Normal u
    11·1 answer
  • Read the following sentences: “The Soviet Union’s famous launch of a satellite called Sputnik had been an embarrassment for the
    12·1 answer
  • Any one have a snnaap chhhaatt if so i need help with something n there
    15·2 answers
  • 1.Two robots start out at 426c cm. apart and drive towards each other. The first robot drives at 5 cm per second and the second
    15·1 answer
  • As a student, how will you avoid those problems/case in the community?​
    14·2 answers
  • My sister told me an extremely funny joke. what is the direct object for this sentence ?
    6·1 answer
  • List different examples of models​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!