O'Reilly logo

Visual Basic® 2012 How to Program, Sixth Edition by Paul Deitel, Abbey Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.13. Searching a Sorted Array with Array Method BinarySearch

Linear searches work well for small or unsorted arrays, but, for large unsorted arrays, linear searching is inefficient. If the array is sorted, the high-speed binary search technique can be used with class Array’s BinarySearch method. Our app that demonstrates method BinarySearch is nearly identical to the one in Fig. 7.14, so we show only the differences here. The complete code is located in the Fig07_15 folder with this chapter’s examples. The sample outputs are shown in Fig. 7.15. The GUI for this app is identical to the one in Fig. 7.13.

a) Creating random values to search

Image

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required