[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
how to find all solutions for reordering of vector  XML
Forum Index » Java Programming
Author Message
sara12345

1 cup a day

Joined: 12/26/2009 13:24:27
Messages: 28
Offline

hello everyone
-I have problem in finding all possible solutions for reordering of vector.

-I have vector named (vect_temp) and I want to find all possible reordering of this vector.

-I have function named Min_diff(vect_temp,next_point) works as follows : I should gave it an element (next_point) in the vector (vect_temp) and it must generate the vector (vect_diff) that contains all possible elements next elements.

-The function nex_min(vect_temp,next_point) works as follows : I should gave it an element (next_point) in the vector (vect_temp) and it must generate the vector (vect_min) that contains all possible elements next elements.

-reordering critriea:
-Min_diff(vect_temp,next_point) and nex_min(vect_temp,next_point) and (next_point) in this first iteration is equal to any selected element in the (vect_temp). after calling the functions, if element in the (vect_diff) is equal to the element in ( vect_min) then add this element into the ordered set [ vec_ordering] and call functions Min_diff(vect_temp,next_point) and nex_min(vect_temp,next_point) again , next_point now is the equal to the element that we have been added in the previous step into the ordered set [ vec_ordering] and repeat this process until all elements in (vect_temp) are ordered according to this criteria.

- I'm able to do reordering according to the cirtira above and find one solution. but the problem is that if (vect_diff) contains many elements that equal to many elements in ( vect_min), in this case I need to do reordering for the first equal element and this will be one solution and then find reordering for the next equal element and so on.

let's consider this example:
- let (vect_temp) contains element [5,9,7,3,1]
- for the firs iteration let the next_point equal to 7
- after calling function Min_diff(vect_temp,next_point), then (vect_diff) will contain [ 5,9,3]
- after calling function nex_min(vect_temp,next_point), then ( vect_min) will contain [ 5,9]
so for now (vect_diff) and ( vect_min) will have two equal elements.
- the first solution must be that fist take the first equal element and do reordering such that ordered set [ vec_ordering] will equal to [7,5] then call functions Min_diff(vect_temp,next_point), and nex_min(vect_temp,next_point) again. the( next_point) in this iteration is qual to 5, these funtions will find next elements, let's consider that (vect_diff) and ( vect_min) will have equal element [3] then add this element to the ordered set [ vec_ordering] and repeat calling functions util all elments in (vect_temp) are added to the ordered set [ vec_ordering]. This will be one solution. now the second solution will be is to take second equal elment [9] instead of [5] and continue calling functions and finding ordered list.
so that each time vect_diff and vect_min will have many equal elements, then do reordering for first equal element this is one solution and then do reordering for the second equal element and so on.

-my code that can only find one solution that takes only first equal element in (vect_diff) and ( vect_min) and continue ordering is below

I hope that someone can answer me how to find all posssible reordering set it is urgent pleasssssse






 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.8 © JForum Team
This site built by Scott Dunbar of Xigole Systems. © 2005-2010 - Scott Dunbar
Java and the Java Get Powered logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
hotjoe.com and xigole.com have no affiliation with Sun Microsystems, Inc.