pseudocódigo
Publicado por helena (2 intervenciones) el 15/12/2021 20:09:53
Hola, necesito una ayudita con este pseudocódigo. necesito pasarlo a la siguiente clase java, en le método _run, y la verdad que no tengo ni idea de cómo se haria. alguien me podrá ayudar?
el pseudocódigo es el siguiente:
for each i ∈ {1, . . . , n} do
if π i ̸= i then
j ← index for which πj = i
π ← π · ρ(i, j)
endif
endfor
el pseudocódigo es el siguiente:
for each i ∈ {1, . . . , n} do
if π i ̸= i then
j ← index for which πj = i
π ← π · ρ(i, j)
endif
endfor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class PrefixSort extends SequenceRearrangementAlgorithm {
/**
* Default constructor
*/
public PrefixSort() {
}
@Override
protected void _run(Permutation l) {
int n = l.size();
// This method implements PrefixSort.
// See the slides for a description.
// Remember to increase the counter numOperations
// each time a reversal is made.
//------------- TO COMPLETE -------------
//---------------------------------------
}
@Override
public String getName() {
return "PrefixSort";
}
@Override
public boolean isSignedCompatible() {
return false;
}
}
Valora esta pregunta


0