Advertisement
Aldin-SXR

AbstractSort.class

Mar 31st, 2020
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. package ds.merge.sort.recursive;
  2.  
  3. public abstract class AbstractSort {
  4.    
  5.     /* Returns whether the first element is less than the second one */
  6.     public static boolean less(int v, int w) {
  7.         return v < w;
  8.     }
  9.    
  10.     /* Swaps the two elements in an array */
  11.     public static void swap (int[] elements, int a, int b) {
  12.         int tmp = elements[a];
  13.         elements[a] = elements[b];
  14.         elements[b] = tmp;
  15.     }
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement