Solved

# Find the smalles Keys in a Vector

Posted on 2011-05-10
258 Views
Hi all

I have double vectors
****************************
a:: {78.00 43.00 10.00};
****************************

b::  (1...n) vectors in a set
Node 0: (0 0)
weight vector: 1.00 1.00 1.00
Genes
****************************
I have  a method get_weight_vector() ..  I can use this to get individual vectors
wVector = map(i).get_weight_vector(); // returns arrary of a vector e.g 1.00 1.00 1.00
****************************
I have another method that compare the value of a and b
and returns type double = 72.12489168102785
****************************

Now for all b's sets compared with static a :
I need to get the smallest value return:: and with the smalles values reference key..
Return the set that the smallest value belongs to..

public double (double map)
double[] staticVector = {78.00 43.00 10.00};
double[] wVector;
double startValue  =  0.0;
for(int i=0; i<map.length; i++){

// method get weight vector return series of : 78.00 43.00 10.00 ;78.00 43.00 10.00 .. 5
wVector = map[i].get_weight_vector(); // returns arrary of all the values  ALL

double returnedValue = (wVector,  staticVector);  // returns double in format 72.12489168102785
//for map[i] with the smallest retured key value.. return the corresponding map Items

//Node 0: (0 0)
//weight vector: 1.00 1.00 1.00
//Genes

if (startValue < returnedValue) // If start value is less than return value
{
startValue  = returnedValue; // somehow I need to change the startValue to the smallest value
// or keep a reference to the smallest key during the interation
}
sort map.. until we find the map with smalles key value
If we find the smallest.. return the set:
}
0
Question by:ZURINET

Accepted Solution

Hi all
For those who might be still working on this problem ..
This problem has been solved..
will close in in 5 mins  ... sorry
0

Author Closing Comment

Solve the problem
0

## Featured Post

### Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input: