This article describes the noDups removal duplicate algorithm of Java data structure and algorithm. Share it for your reference, as follows:
public static void noDupa(int[] a){ int count = 0;//in int sub = 0;//Counter for(int i=0; i<a.length-1; i++){//External loop if(a[i] != a[i+1]){ a[count] = a[i]; count++; } }}PS: I feel that this algorithm is nothing, but it is actually quite exquisite! ! Prerequisite---The array is already ordered, please taste it carefully
For more information about Java algorithms, readers who are interested in this site can view the topics: "Java Data Structure and Algorithm Tutorial", "Summary of Java Operation DOM Node Tips", "Summary of Java File and Directory Operation Tips" and "Summary of Java Cache Operation Tips"
I hope this article will be helpful to everyone's Java programming.