program to brute force search, JAVA Programming

Introduction

As an alternative to the Binary Search algorithm, also it could be done by the brute-force method given below.

public static int rank(int key, int[] a) {
    for (inti=0; i         if (a[i]==key) return i ;
    return -1 ;
}

Procedure

Write a program BruteForceSearch that uses the brute-force approach given above and compare its running time on your computer with that of Binary Search for largeW.txt and largeT.txt, both available on moodle. Compare running times when running in two modes.

1. Results printed on screen:

javaBruteForceSearchlargeW.txt

2. Results redirected to a file:

javaBruteForceSearchlargeW.txt result.txt

You will (hopefully) see that solving the whitelist problem for a large number of inputs is not feasible without efficient algorithms such as binary search and mergesort.

Deliverable

a short report, including

  1. a code listing for BruteForceSearch.java
  2. a derivation of the predicted performance for both algorithms as functions of N, the number of records
  3. a comparison of your experimental results with predictions for these algorithms.
Posted Date: 3/8/2013 5:11:08 AM | Location : United States







Related Discussions:- program to brute force search, Assignment Help, Ask Question on program to brute force search, Get Answer, Expert's Help, program to brute force search Discussions

Write discussion on program to brute force search
Your posts are moderated
Related Questions
Need Toward Privacy Preserving and Collusion Resistance in a Location Proof Updating System Project Description: Today's location-sensitive service relies on user's mobile de

There is no separate homework this week, but you may complete the exercises ahead of time, in which case you only need to attend for long enough to get your work marked off by your

Question: (a) Explain the importance of abstract classes in Java with an appropriate example. (b) Explain what is meant by an interface in Java? Use a simple example to il

Project Description: I want to modify Joomla component. Now there is Akeeba subscription component on this site. It works and the whole thing is fine, but there is no "teaser

Give an Examples of java.lang.Math Methods Here is an instance program in which exercises most of the routines in java.lang.Math. If your high school math is a little rusty, do

Loosely coupled SOA SOA gives in loosely coupled application elements, in which message is not necessarily tied to a particular database. Loose coupling actives enterprises to

List the precedence table? At last let's add the && , || , & , | and ? operators to the precedence table *, /, % Multiplicative operators +, - Additi

What types of new jobs are created because of computing? And that old professions are being eliminated? Because of computing whereas people are getting benefits from automated

What is the difference between a while statement and a do while statement? A while statement checks at the starting of a loop to see whether the next loop iteration should occu

Describe The ? operator in Java langauge? The conditional operator just works for assigning a value to a variable, using a value within a method invocation, or in a few other w