home1/description.html

22 lines
871 B
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>Balls</title>
</head>
<body>
<p>
Olgu massiivis juhuslikult läbisegi punased ja rohelised pallid. Koostage võimalikult kiire meetod, mis järjestaks massiivi ümber nii, et kõik punased pallid oleksid massiivi alguses ja kõik rohelised pallid lõpus. Arvestage ka piirjuhtumiga, et kõik pallid on üht värvi.
</p>
<p>
An array contains red and green balls in random order. Write a possibly fast method to rearrange the array, so that all red balls are at the beginning and all green balls are at the end of the array. Consider the case when all balls have the same color.
</p>
<pre>
enum Color {green, red};
</pre>
<pre>
public static void reorder (Color[] balls)
</pre>
</body>
</html>