This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c=("\e[38;5;9m" "\e[38;5;10m" "\e[38;5;11m" "\e[38;5;13m" "\e[38;5;14m") | |
while true; do | |
for((x=0; x < 5; x++)); do | |
echo -e "${c[x]}" | |
for((i=0; i < 80; i++ )); do | |
for((j=0; j < 80; j++ )); do | |
echo -n "e" | |
done | |
echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void bubble () { | |
int[] n = {5, 9, 4, 3, 7, 13, 5, 1}; | |
System.out.println(Arrays.toString(n)); | |
int l = n.length; | |
int f = l-1; | |
int tmp = 0; | |
for (int i=l;i>0;i--) { | |
for (int x=0;x<f;x++) { | |
if (n[x] > n[x+1]) { | |
tmp = n[x]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class bubble { | |
public static void main (String args[]) { | |
int[] n = {900, 5, 9, 4, 3, 7, 13, 5, 1, 80, 90, 40, 60, 10, -54, 10, 2, -9090}; | |
System.out.println(Arrays.toString(n)); | |
System.out.println(Arrays.toString(bubble(n))); | |
} | |
public static int[] bubble (int n[]) { | |
int tmp, l = n.length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(123456789)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(123)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(1234)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(12345)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(1233)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(12334)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(12345561)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(1234556123)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(12)); | |
System.out.println(!conteUnaSerieCapicuaDeLlargadaAlMenys3(1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String figuraSensePrint(int n1,int n2){ | |
String s=""; // amb StringBuffer o StringBuilder millor | |
s="\n\nFigura "+n1+" "+n2+":\n\n"; | |
for (int i=0;i<n1;i++){ | |
s+="@\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Program.java 1.0 {date} | |
* | |
* Copyright {year} Charly Koch Busquets <[email protected]> | |
* | |
* This is free software, licensed under the GNU General Public License v3. | |
* See http://www.gnu.org/licenses/gpl.html for more information. | |
*/ | |
public class Program { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class Program { | |
public static void main (String args[]) { | |
int[] arr = rndArrInt(100000, -100, 100); // Retorna un array de llargaria 100000 amb nombres aleatoris de -100 a 100 | |
System.out.println(frequent(arr)); | |
} | |
public static int[] rndArrInt (int llarg, int min, int max) { | |
Random rand = new Random(); | |
int[] arr = new int[llarg]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class Program { | |
public static void main (String args[]) { | |
int[] arr = rndArrInt(100000, -1000, 1000); | |
System.out.println("------------------------------"); | |
System.out.println("Solució frequent Alex v1: "); | |
long startTime = System.nanoTime(); | |
System.out.println(frequentv1(arr)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class Program { | |
public static void main (String args[]) { | |
int[][] o = new int[][]{ | |
{ 1, 20, 10 }, | |
{ 6, 3, 18 } | |
}; | |
int[][] d = new int[o[0].length][o.length]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Cotxe { | |
public static void main (String args[]) { | |
Cotxe c = new Cotxe("Seat"); | |
c.setVelocitat(150); | |
System.out.println(c); | |
} | |
public final static float MAX_SPEED = 130; | |
private String marca; |
OlderNewer