File:Binary_Search_Depiction.svg
From Wikipedia, the free encyclopedia
Size of this PNG preview of this SVG file: 470 × 200 pixels. Other resolutions: 320 × 136 pixels | 640 × 272 pixels | 1,024 × 436 pixels | 1,280 × 545 pixels | 2,560 × 1,089 pixels.
Original file (SVG file, nominally 470 × 200 pixels, file size: 6 KB)
This is a file from the Wikimedia Commons. Information from its description page there is shown below. Commons is a freely licensed media file repository. You can help. |
Summary
DescriptionBinary Search Depiction.svg |
English: This is an example of a binary search steps through time. Source code and output:
int[] numbersArray = {1,3,4,6,7,8,10,13,14,18,19,21,24,37,40,45,71};
public boolean binarySearchAlgorithm(int targetNumber, int[] numbers)
{
int lowerLimit = 0;
int upperLimit = numbers.length - 1;
while (upperLimit >= lowerLimit)
{
int middleNumber = (lowerLimit + upperLimit)/2;
if (numbers[middleNumber] == targetNumber)
{
return true;
}
if (numbers[middleNumber] < targetNumber)
{
lowerLimit = middleNumber + 1;
}
if (numbers[middleNumber] > targetNumber)
{
upperLimit = middleNumber - 1;
}
}
return false;
}
System.out.println(binarySearchAlgorithm(7, numbersArray)); //prints "true"
iteration 1
iteration 2
iteration 3
iteration 4
|
Date | |
Source | Own work |
Author | AlwaysAngry |
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Items portrayed in this file
depicts
some value
30 November 2016
image/svg+xml
b8165b6ea1ea892f92e32bae011e05e71bc5fcd2
5,806 byte
200 pixel
470 pixel
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 15:33, 1 December 2016 | 470 × 200 (6 KB) | AlwaysAngry | User created page with UploadWizard |
File usage
The following pages on the English Wikipedia use this file (pages on other projects are not listed):
Global file usage
The following other wikis use this file:
- Usage on ar.wikipedia.org
- Usage on ary.wikipedia.org
- Usage on bn.wikipedia.org
- Usage on fa.wikipedia.org
- Usage on fr.wikipedia.org
- Usage on he.wikipedia.org
- Usage on hu.wikipedia.org
- Usage on kn.wikipedia.org
- Usage on ko.wikipedia.org
- Usage on mk.wikipedia.org
- Usage on pl.wikipedia.org
- Usage on ru.wikipedia.org
- Usage on sr.wikipedia.org
- Usage on sv.wikipedia.org
- Usage on th.wikipedia.org
- Usage on vi.wikipedia.org
- Usage on www.wikidata.org
- Usage on zh-yue.wikipedia.org
- Usage on zh.wikipedia.org
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
Width | 470px |
---|---|
Height | 200px |
Retrieved from "https://en.wikipedia.org/wiki/File:Binary_Search_Depiction.svg"