Binary Search

  • If we have an array that is in ascending or descending order, we can use a binary search.
    • We pick the mid-point of the array.
      • If we have found our search term, our work is done.
    • If the search term is not there, we split the array in two segments.
      • If our search term is higher than our current term, binary search the top half.
      • If our search term is lower than our current term, binary search the bottom half.
    • Continue until found, or until the term is not found.

The pseudo code of Binary Search is given below:

BinarySearch Pseudocode

The Java source code of Binary Search is given below:

BinarySearch Source code

Pseudo code and Java source code of Linear Search

Searching

  • Searching algorithms allow us to find a specific element in an array.
    • We often want to know if an element is present in an array before performing some operation.
  • If we are storing a list of names, we will want to check to make sure a name is not already there.
  • Searching algorithms allow us to do that.
    • And also, it can allow us to find out specifically where the element is if that is needed.

Linear Search

  • The simplest and most costly search is a linear search.
    • We start at the beginning of an array.
    • We check each element in turn to see if it is our desired element.
    • We continue until we get to the end.
  • Linear search is simple to code, and simple to understand.
  • But it also has performance issues.

The pseudo code of linear search using function is shown below:

Linear Search Pseudocode

The java source code of linear search using function is shown below:

Linear Search

Obtaining a Google Maps API key

If you want to get google maps API Key for Android Project, follow the following steps :

  1. Navigate to your project in the Google APIs Console.
  2. In the Services page, verify that the “Google Maps Android API v2″ is enabled.
  3. In the left navigation bar, click API Access.
  4. In the resulting page, click Create New Android Key….
  5. In the resulting dialog, enter the SHA-1 fingerprint, then a semicolon, then your application’s package name. For example: 45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0;com.example
  6. The Google APIs Console responds by displaying Key for Android apps (with certificates) followed by a forty-character API key, for example:
    AIzaSyDftcYHqPFYDHNINji4mWrJQo_TKKIgiSA

 

Running a keytool

  1. Run the command prompt.
  2. cd C:\Program Files\Java\jdk1.7.0_09\bin
  3. keytool -exportcert -alias androiddebugkey -keystore “C:\Users\userName\.android\debug.keystore” -list -v
  4. The base password is android.
  5. You will be presented with the MD5, SHA1, and SHA256 keys; choose the one you need.

 

https://developers.google.com/maps/documentation/android/start

http://stackoverflow.com/questions/5488339/how-can-i-find-and-run-the-keytool

http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/