Search:

Type: Posts; User: nicsa

1. Thread: Removing Duplicate Values From an Array

by nicsa
Replies
6
Views
2,329

Removing Duplicate Values From an Array

I am to remove all duplicates form an array.

For example:
4 7 11 4 9 5 11 7 3 5
should be changed to
4 7 11 9 4 3

I am not supposed to use hashtables. Is there a simple way to do this. I...
2. Thread: Sorting and Searching: Most Efficient Code

by nicsa
Replies
7
Views
479

Re: Sorting and Searching: Most Efficient Code

I don't get what you mean
3. Thread: Sorting and Searching: Most Efficient Code

by nicsa
Replies
7
Views
479

Re: Sorting and Searching: Most Efficient Code

public int sortedSearch(int value)
{
int x=0;
while(x<a.length)
{
if(a[x]==value)
{
return x;
}
else
4. Thread: Sorting and Searching: Most Efficient Code

by nicsa
Replies
7
Views
479

Re: Sorting and Searching: Most Efficient Code

public int sortedSearch(int value)
{
for(int x=0;x<a.length; x++)
{
if(a[x]==value)
return x;
}
return -1;
}
5. Thread: Sorting and Searching: Most Efficient Code

by nicsa
Replies
7
Views
479

Sorting and Searching: Most Efficient Code

I am trying to create a method to search a sorted array for a value in the most efficient way possible. My teacher doesn't want us to use binary search yet. This is the code I have so far, is there...
6. Thread: HELP, I AM HAVING A PROBLEM WITH ADDING VALUES OF AN ARRAY TO A STRING

by nicsa
Replies
3
Views
423

HELP, I AM HAVING A PROBLEM WITH ADDING VALUES OF AN ARRAY TO A STRING

Hi, I seem to be having a consistent error when I try to add the values of an array I created to a String. I keep getting a NullPointerException Error. I went through and checked to make sure that...

by nicsa
Replies
6
Views
763

Re: NullPointerException Error

It was my toString, that was dumb of me.

by nicsa
Replies
6
Views
763

Re: NullPointerException Error

I am adding the values in the salespersonTotal method.

by nicsa
Replies
6
Views
763

Re: NullPointerException Error

This is what I get when I print out the values:

System.out.println(productTotal[0]);
System.out.println(productTotal[1]);
System.out.println(productTotal[2]);...