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
zloy xaker [14]
3 years ago
12

When using the BinarySearch() method of an array or list type, what value is returned when the element is not found? How can we

decode this value and make use of it?
Computers and Technology
1 answer:
Step2247 [10]3 years ago
5 0

Answer:

When the element is not found we return -1.

Explanation:

When we use binary search we use BinarySearch() method of an array or list type when the element is found we return the index of the element if found if the element is not found we return -1.

We can decode this value since it is less than 0 and the indexing of arrays and lists starts with 0 upto the size-1.So -1 index is not present in the array or list.We have to check if the index is < 0 then the element is not present in the array or list.

for ex:-

if(index<0)

{

    System.out.println("Element is not present in the array");

}

You might be interested in
Which of the following could result from heat being transferred to a substance?
lbvjy [14]

Answer: i dont see the following sorry cant help ya

Explanation:

8 0
3 years ago
I don't understand how to write code for this in Java using nested for loops only. The official question is: write a program tha
Bingel [31]

Answer:

public class Triangle

{

public static void main( String[] args )

{

show( 5 );

}

public static void show( int n )

{

int i,j,k;

for (i = 0; i < n - 1; i++ )

{

for (j = 0; j < i; j++ )

{

System.out.print( " " );

}

for (k = n - i; k > 0; k-- )

{

System.out.print( "* " );

}

System.out.println();

}

for (i = 0; i < n; i++ )

{

for (j = n - i; j > 1; j-- )

{

System.out.print( " " );

}

for (k = 0; k < i + 1; k++ )

{

System.out.print( "* " );

}

System.out.println();

}

4 0
3 years ago
State one advantage of organising data into columns and rows
Bezzdna [24]
It's neat organized and ready to find when needed
6 0
3 years ago
Examples in types of experimental methods <br>​
Elodia [21]

Lab Experiment

Field Experiment

Natural Experiment.

3 0
3 years ago
Read 2 more answers
What is the numeric range of a 16-bit twos complement value? A 16-bit excess notation value? A 16-bit unsigned binary value?
blagie [28]

Answer:

twos complement value is (-2^15 -1) -32768 to 32767.

excess notation value is -32768 to 32767.

unsigned binary value is (2^16) 0 to 65535

Explanation:

Excess notation: used to represent signed integers. Always uses fixed number of bits with leftmost representing the sign.

Twos complement notation: As opposed to excess notation, a sign bit of 0 is used to represent the non-negative (+) sign and a 1 for the negative (-); again, zero is included in the non-negative set.

Unsigned Binary values: are binary values/bits that don't have signs

7 0
4 years ago
Other questions:
  • A cell reference that has only one $ is referred to as a(n) ____ cell reference. alternative mixed relative absolute
    7·1 answer
  • Page orientation can be either landscape or _____.
    13·1 answer
  • What are the six critical components of an information system? Select three of the six components, and describe a potential vuln
    15·1 answer
  • All systems have ___________.
    9·2 answers
  • David owns a retail business that just implemented a web app to supplement sales. He needs to choose an attribution partner to i
    15·1 answer
  • do you think that some people have difficulty talking to others face to face because of how prevalent texting is today
    15·2 answers
  • JPG is considered a lossy file format. What does this mean?
    15·2 answers
  • How to write cube of a number from flowchart ​
    5·1 answer
  • What electronic appliances at your home / school can be controlled remotely? Name any 4
    7·1 answer
  • How do you initiate a sprite’s actions in a scene?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!