Java data structure and algorithm nodups removal of duplicates algorithm example _java

Source: Internet
Author: User

The example of this paper describes the Java data structure and algorithm of the nodups removal of duplicate algorithm. Share to everyone for your reference, specific 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++) {// Outer Loop
    if (A[i]!= a[i+1]) {
      A[count] = a[i];
      count++
    }}
  }


PS: Feel this algorithm rough to see what, in fact, quite exquisite!! Prerequisites---Arrays are in order, thin and tasteful.

More about Java algorithms Interested readers can view the site topics: "Java data structure and algorithms tutorial", "Java Operation DOM node skills summary", "Java file and directory operation tips Summary" and "Java Cache operation Tips"

I hope this article will help you with Java programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.