fusion vecteur ordonner java
Java
public static int[] fusion2 ( int[] tab1, int[]tab2 ){
int[] result= new int[tab1.length+tab2.length];
int index1=0;
int index2=0;
int i=0;
while (i<tab1.length+tab2.length && index1!=tab1.length && index2 != tab2.length){//on vérifie qu'on sort d'aucun des 3 tableaux sinon sa te fournit une erreur
if (tab1[index1]<=tab2[index2]){ //si le tableau 1 est <= au tableau 2
result[i]=tab1[index1];
index1++;
}
else if(tab1[index1]>tab2[index2]){ //si le tableau 1 est > au tableau 2
result[i]=tab2[index2];
index2++;
}
i++;
}
//dans le cas ou les deux tableaux ne font pas la même taille
while (index1 < tab1.length){ //le premier tableau est plus grand que le second
result[i]=tab1[index1];
i++;
index1++;
}
while (index2 < tab2.length){ //la c'est le second
result[i]=tab2[index2];
i++;
index2++;
}
return result;
}
Also in Java:
- Title
- funzione random in java
- Category
- Java
- Title
- searching in database using java
- Category
- Java
- Title
- java making a screen
- Category
- Java
- Title
- get host from request object java
- Category
- Java
- Title
- how to get the dimensions of a 2d array in java
- Category
- Java
- Title
- how to check the end of a string java
- Category
- Java
- Title
- java random numbers in specific range
- Category
- Java
- Title
- java code to get all leaf nodes of a xml file
- Category
- Java
- Title
- socket programming in java
- Category
- Java
- Title
- decomposer chaine de caractère java
- Category
- Java
- Title
- java - get open ports
- Category
- Java
- Title
- not equal to java
- Category
- Java
- Title
- primitive data types in java
- Category
- Java
- Title
- java how to get all threads
- Category
- Java
- Title
- 2d array length in java
- Category
- Java
- Title
- java 8 list stream delete by name
- Category
- Java
- Title
- org.springframework.orm.jpa.EntityManagerHolder cannot be cast to org.springframework.orm.hibernate5.SessionHolder
- Category
- Java
- Title
- java calculator code
- Category
- Java
- Title
- bootstrap alert
- Category
- Java
- Title
- jbutton remove selection border
- Category
- Java
- Title
- java read integer from text file into array scanner
- Category
- Java
- Title
- java php object
- Category
- Java
- Title
- java read lines from file
- Category
- Java
- Title
- how to use spring in java
- Category
- Java
- Title
- how to import a scanner in java
- Category
- Java
- Title
- official java website
- Category
- Java
- Title
- scanner check if int
- Category
- Java
- Title
- install java debian 8
- Category
- Java
- Title
- java execute for cycle parallel thread
- Category
- Java
- Title
- read csv java
- Category
- Java
- Title
- room insert and return id
- Category
- Java
- Title
- java string to int
- Category
- Java
- Title
- from file to array java
- Category
- Java
- Title
- reverse number in java
- Category
- Java
- Title
- how to create a Rectangle in java
- Category
- Java
- Title
- java vs python
- Category
- Java
- Title
- change the value in a hashtable java
- Category
- Java
- Title
- java random number between 100 and 999
- Category
- Java
- Title
- bukkit register commands
- Category
- Java
- Title
- copy array in java
- Category
- Java
- Title
- goodbye java
- Category
- Java
- Title
- convert array of int to arraylist java
- Category
- Java
- Title
- adb: command not found
- Category
- Java
- Title
- prendere valore da tastiera java
- Category
- Java
- Title
- double to string java
- Category
- Java
- Title
- android dynamically create layer-list with item and shape site:stackoverflow.com
- Category
- Java
- Title
- send variable intent
- Category
- Java
- Title
- how to crate a list in java script
- Category
- Java
- Title
- setting up javafx in eclipse
- Category
- Java
- Title
- intellij set target bytecode version
- Category
- Java
- Title
- jar file not running after being compiled
- Category
- Java
- Title
- removeeventlistener
- Category
- Java
- Title
- raise number to power java
- Category
- Java
- Title
- random processing
- Category
- Java
- Title
- java how to print a newline
- Category
- Java
- Title
- java recursion
- Category
- Java
- Title
- replace all punctuation in string java
- Category
- Java
- Title
- run java classpath command line
- Category
- Java
- Title
- recursion in java
- Category
- Java
- Title
- onbackpressed android
- Category
- Java
- Title
- como saber de que tipo es una variable en java
- Category
- Java
- Title
- a recursive function that calculates the greatest common divisor from user's input in java
- Category
- Java
- Title
- java print syntax
- Category
- Java
- Title
- get spring application context
- Category
- Java
- Title
- java fx display simple rectangle
- Category
- Java
- Title
- java get command line input
- Category
- Java
- Title
- cannot fit requested classes in a single dex file
- Category
- Java
- Title
- java scanner next()
- Category
- Java
- Title
- how to get a user input in java
- Category
- Java
- Title
- java min function
- Category
- Java
- Title
- java list contains object with property
- Category
- Java
- Title
- how to return the lower of two values in one line java
- Category
- Java
- Title
- int to string java
- Category
- Java
- Title
- convert string to int java
- Category
- Java
- Title
- java mockito any string import
- Category
- Java
- Title
- how to input in java
- Category
- Java
- Title
- how to open a folder in java swing project
- Category
- Java
- Title
- java rest client response json
- Category
- Java
- Title
- que es un length en java
- Category
- Java
- Title
- how to write sensor data into file android studio
- Category
- Java
- Title
- java remove duplicates
- Category
- Java
- Title
- actionListener java
- Category
- Java
- Title
- how to check if the file has remaining without reading from it java
- Category
- Java
- Title
- json request body not getting parsed by spring boot controller
- Category
- Java
- Title
- run static method java
- Category
- Java
- Title
- how to define an arraylist in java
- Category
- Java
- Title
- java manacher's algorithm
- Category
- Java
- Title
- how to test for legit email in java
- Category
- Java
- Title
- java read string input
- Category
- Java
- Title
- how to convert string to double in android studio
- Category
- Java
- Title
- how to add strings in java
- Category
- Java
- Title
- how to play an audio in java
- Category
- Java
- Title
- android create snackbar
- Category
- Java
- Title
- foreach java
- Category
- Java
- Title
- how to set frame colo in java
- Category
- Java
- Title
- Java how to handle HTTP GET request after establishing TCP connection
- Category
- Java
- Title
- how to copy all files and subdirectories in directory in java
- Category
- Java
- Title
- how to fix Index 2 out of bounds for length 2 when looping through an array in java
- Category
- Java
- Title
- how to make a list java
- Category
- Java
- Title
- demo java file
- Category
- Java