Search:

Type: Posts; User: Semion

1. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

How do you unbox?
2. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

I see. I'm looking at the API and I don't see any other method that can find a duplicate. Is there another way?
3. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

I tried using Vector<Integer> but I'm still having problems matching the sum to every value in the container.

public static void main(String[] args) {

Vector<Integer> sumArray = new...
4. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

I was thinking the same thing about closing off the first for loop. The way I have it, the for loop is checking the current sum against each previous sum for a match, except on the first roll there...
5. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

Still not working. I have:

for (int k = 0; k < sumArray.length; k++){

for (int j = sumArray.length - 1; i < j; j--){

if...
6. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

Thanks for the reply. I tried this code but it still has the sum equal to the value in the index. I see where you're going here in the linear search going backwards. Great idea. Now I just need to...
7. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

You are correct. Forgive the confusing sentence. I meant that the value inside each index is equal to the sum.
8. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

Re: How To Use Linear Search

The code does compile and run. That particular module is what I thought was a linear search through the array. I used some println statement to see what's happening in the run. It looks like the sum...
9. Thread: How To Use Linear Search

by Semion
Replies
17
Views
798

How To Use Linear Search

Hi all,

I'm having a problem using a linear search to find a duplicate. Here's the details of my program:

I roll two dice continually and get random numbers, 1-6. If I roll two of the same...
Results 1 to 9 of 9