- 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:
The Java source code of Binary Search is given below:
- 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.
- 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:
The java source code of linear search using function is shown below:
This is a sample test case for Software Development Techniques Assignment. You have to create at least 25 different test cases altogether for different functions. Remarks section is optional.
Write a pesudo code & java program to find factorial using function.
This is the pseudo code for the function example that I had posted earlier.
This post demonstrates the simple example of functions returning value and passing arguments.
The following tutorial shows how to integrate Google maps API v2 in Android Apps.
Some modifications are to be made in AndroidManifest.xml. You need to add following tags in <application> tag.
If you want to get google maps API Key for Android Project, follow the following steps :
- Navigate to your project in the Google APIs Console.
- In the Services page, verify that the “Google Maps Android API v2″ is enabled.
- In the left navigation bar, click API Access.
- In the resulting page, click Create New Android Key….
- 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
- The Google APIs Console responds by displaying Key for Android apps (with certificates) followed by a forty-character API key, for example:
Running a keytool
- Run the command prompt.
- cd C:\Program Files\Java\jdk1.7.0_09\bin
- keytool -exportcert -alias androiddebugkey -keystore “C:\Users\userName\.android\debug.keystore” -list -v
- The base password is android.
- You will be presented with the MD5, SHA1, and SHA256 keys; choose the one you need.