Which three insertions properly complete the pseudo-code?

Given the incomplete pseudo-code for a fork/join framework application:

submit(Data) {

if(Data.size < SMALL_ENOUGH) {

_________________(Data); // line x

}

else {

List<Data> x = _________________(Data); // line Y

for(Data d: x

______________(d); // line z

}

}

And given the missing methods:

process, submit, and splitInHalf

Which three insertions properly complete the pseudo-code?

Given the incomplete pseudo-code for a fork/join framework application:

submit(Data) {

if(Data.size < SMALL_ENOUGH) {

_________________(Data); // line x

}

else {

List<Data> x = _________________(Data); // line Y

for(Data d: x

______________(d); // line z

}

}

And given the missing methods:

process, submit, and splitInHalf

Which three insertions properly complete the pseudo-code?

A.
Insert submit at line X.

B.
Insert splitInHalf at line X.

C.
Insert process at line X.

D.
Insert process at line Y.

E.
Insert splitInHalf at line Y.

F.
Insert process at line Z.

G.
Insert submit at line Z.

Explanation:
C: If data is small enough then process it. Line X
E: If data is not small enough then split it half. Line Y
G: After the data has been split (line Y) then recursively submit the splitted data (Line z).



Leave a Reply 1

Your email address will not be published. Required fields are marked *