[java] activity Greedy

Pagina: 1
Acties:

  • comprobot
  • Registratie: Augustus 2000
  • Laatst online: 07-08 19:54
public int[] greedyactivitiy(int[] S, int[] f)
{ int n = S.length();
int[] A = {1};
int j = 1;

for (i =0; 2 > n; i++)
{
if S[i] >= F[j]
{
// A = A U {i}
j = i;
}
}

een probleem: U in java code zou moeten vertaald. hoe kan ik met U ?
U = vereniging tussen twee verzamelingen.

www.tiedragon.nl


  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 23-08 10:39

Janoz

Moderator Devschuur®

!litemod

Mischien is het handiger om de hiervoor bedoelde objecten te gebruiken. Kijk ff naar List in javadoc.

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • comprobot
  • Registratie: Augustus 2000
  • Laatst online: 07-08 19:54
List in Collection? Ik heb wel javadoc gelezen. maar het gaat erom combinatie met array en list. Is het wel mogelijk?

www.tiedragon.nl


  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 23-08 10:39

Janoz

Moderator Devschuur®

!litemod

1. Schrijf eens wat fatsoenlijk nederlands
2. Waarom zou ik je die tip geven als het niet zou kunnen?

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • whoami
  • Registratie: December 2000
  • Laatst online: 23:02

https://fgheysels.github.io/


  • Dash2in1
  • Registratie: November 2001
  • Laatst online: 19-08 23:13
Ik zou eens kijken naar java.util.Set en java.util.HashSet ..
Pagina: 1