- // Find position of element to be deleted
- int pos = binarySearch(0, getCurrentSize(), value);
-
- if (pos == -1)
- {
- System.out.println("Valeur à supprimer inexistante");
- return false;
- }
-
- // Deleting element
- for (int i = pos; i < getCurrentSize() - 1; i++) {
- int_array[i] = int_array[i + 1];
- }
-
- current_size--;
- return true;
+ for (int i = 0; i < getCurrentSize(); i++) {
+ if (int_array[i] == value) {
+ // Deleting the element in the tab
+ for (int j = i; j < getCurrentSize() - 1; j++) {
+ int_array[j] = int_array[j + 1];
+ }
+ current_size--;
+ return true;
+ }
+ }
+ return true;