Find the smalles Keys in a Vector

Posted on 2011-05-10
Last Modified: 2012-08-14
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
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..

below see below for more info..
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 
		 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: 

Open in new window

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

    Author Closing Comment

    Solve the problem

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    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:

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now