Click here to Skip to main content
15,926,290 members
Home / Discussions / Java
   

Java

 
AnswerRe: please help Pin
EliottA19-Aug-09 5:40
EliottA19-Aug-09 5:40 
AnswerRe: please help Pin
TorstenH.19-Aug-09 21:48
TorstenH.19-Aug-09 21:48 
GeneralRe: please help Pin
EliottA20-Aug-09 6:05
EliottA20-Aug-09 6:05 
QuestionDate Dialog Box Pin
alonchap17-Aug-09 23:08
alonchap17-Aug-09 23:08 
AnswerRe: Date Dialog Box Pin
David Skelly18-Aug-09 2:14
David Skelly18-Aug-09 2:14 
QuestionMake a client to client chat socket programming with Java Pin
cem tezer17-Aug-09 17:49
cem tezer17-Aug-09 17:49 
AnswerRe: Make a client to client chat socket programming with Java Pin
TorstenH.18-Aug-09 19:53
TorstenH.18-Aug-09 19:53 
QuestionGraph Colouring Pin
Dini_luv16-Aug-09 6:25
Dini_luv16-Aug-09 6:25 
Hi
I have a problem with my graph colouring code,have pasted my methods which I believed were correct until I found two different answers whn using algorithm and code.

Its about colouring different countries using minimul different colours.
Im supposed to get an array[0,0,1,1,2,2,2,2,2,1].
but i get [0,0,0,0,0,0,1,1,0,0].

pliz help.

public void ApproxColour(){
int v, new_colour;

for(v = 0; v<CountryList.size(); v++){
colour[v] = -1;
}

sortVertices();
colour[0]=0;

for(int i=1; i<CountryList.size(); i++){
colour[i] = FindSmallestfreecolour(sorted_country[i]);
}
System.out.println(Arrays.toString(colour));
//return colour;
}

public int FindSmallestfreecolour(String Country){

int w;
boolean used[] = new boolean[CountryList.size()];

for(w=0; w<CountryList.size();w++){
if(isAdjacent(Country, CountryList.get(w).getName()) && colour[w] != -1){
used[colour[w]] = true;
}
}
w=0;
while (used[w])
w++;

return w;
}

public void sortVertices(){
int position = 0;

//System.out.println(Arrays.toString(degrees));
for(int j = 0; j < degrees.length; j++){
int Largest = getLargestDegree();
sorted[position] = Largest;
degrees[Largest] = -1;
position++;

country[j] = CountryList.get(j).getName();
}
//System.out.println(Arrays.toString(sorted));

int var;
for(int i=0; i<sorted.length; i++){
var = sorted[i];
sorted_country[i] = country[var];
}
//System.out.println(Arrays.toString(sorted_country));
}
QuestionHow to Select different Printer for different document? Pin
suzy_bcny15-Aug-09 6:20
suzy_bcny15-Aug-09 6:20 
QuestionElectronical projects with Java? Pin
Mir_As15-Aug-09 3:21
Mir_As15-Aug-09 3:21 
AnswerRe: Electronical projects with Java? Pin
TorstenH.18-Aug-09 20:00
TorstenH.18-Aug-09 20:00 
Questionarray? Pin
benjamin yap12-Aug-09 19:51
benjamin yap12-Aug-09 19:51 
AnswerRe: array? Pin
David Skelly12-Aug-09 22:08
David Skelly12-Aug-09 22:08 
GeneralRe: array? Pin
benjamin yap12-Aug-09 22:27
benjamin yap12-Aug-09 22:27 
GeneralRe: array? Pin
David Skelly13-Aug-09 2:35
David Skelly13-Aug-09 2:35 
Questionencrypt a file using .net and decrypt it using java Pin
nani666611-Aug-09 18:59
nani666611-Aug-09 18:59 
AnswerRe: encrypt a file using .net and decrypt it using java Pin
David Skelly11-Aug-09 22:09
David Skelly11-Aug-09 22:09 
GeneralRe: encrypt a file using .net and decrypt it using java Pin
nani666612-Aug-09 18:46
nani666612-Aug-09 18:46 
GeneralRe: encrypt a file using .net and decrypt it using java Pin
David Skelly12-Aug-09 22:02
David Skelly12-Aug-09 22:02 
QuestionOverriding assignment operator Pin
David Crow11-Aug-09 4:34
David Crow11-Aug-09 4:34 
AnswerRe: Overriding assignment operator Pin
David Skelly11-Aug-09 6:24
David Skelly11-Aug-09 6:24 
Questionregarding generation of random rows from database Pin
mini_mpct10-Aug-09 3:21
mini_mpct10-Aug-09 3:21 
GeneralRe: regarding generation of random rows from database Pin
SinghUlarity...18-Aug-09 4:38
SinghUlarity...18-Aug-09 4:38 
QuestionNew to Java programming! Pin
TaleaS9-Aug-09 14:38
TaleaS9-Aug-09 14:38 
AnswerRe: New to Java programming! Pin
fly9049-Aug-09 23:43
fly9049-Aug-09 23:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.