Posts

Showing posts from June, 2015

Looking inside an Array

Linear search is simplest searching algorithm to find an element in an array. This example has an array with  6 elements. A key is value that we are looking for inside of an array, and we are looking for value 4. Another integer variable index is used for storing index value of element that has matching value as the key value. We initialize index with arr.length , which it return the size of the array. Out search engine build using for loop. This engine will check all the elements in the array one by one. The if statement inside the loop is where it checks whether value of arr at current location indicated by variable i is same as value of key. If the values are equal we change the index value to value of i . Third part is displaying results. If the value of index not equal to arr.length , that means something has happen inside the loop statement. This something can happen only and only if key is found inside the array. So this if statement actually checks whether the key i

Popular posts from this blog

Drawing Simple Pie Chart

VB.net connecting to SQL Server

VB.net