Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Bubble Sort Algorithms     - Linux software firewall ACL match point optimization (Linux)

- Understand the security restore accidentally deleted critical system files (Linux)

- Wine 1.7 is installed on a system based on RedHat or Debian (Linux)

- Figlet use (Linux)

- PostgreSQL using the system cache to improve operational efficiency (Database)

- Ubuntu 32 compile Android 4.0.4 Problems (Linux)

- A step by step teach have to install multi-node cluster configuration Hadoop (Server)

- Use GLOBK batch command network adjustment (Linux)

- Security: Unix operating system intrusion tracking Strikes Back (Linux)

- CentOS 7 source code to compile and install Nginx process record (Server)

- Ubuntu to install systems Indicator Sticky Notes 0.4.4 (Linux)

- Debian 7 and Debian 8 users how to install Oracle Java 8 (Linux)

- RT-11SJ run at ambient PDP-11 MACRO-11 assembly (Programming)

- Adding SSH to Github (Linux)

- Tor Browser: under Linux for anonymous Web browsing ultimate browser (Linux)

- Linux systems for entry-learning: Install closed-source packages in Debian (Linux)

- Deployment Kubernetes manage Docker example cluster on Ubuntu (Server)

- Java List add duplicate the same object (Programming)

- How to use the Linux command compress JPEG images (Linux)

- 256 with rich colors decorate your terminal (Linux)

 
         
  Bubble Sort Algorithms
     
  Add Date : 2017-01-08      
         
       
         
  The basic idea
First, compare the first element and the second element, the first big if, then the two exchanged or not exchanged; then compare the second element and the third element, the second big if, then the two exchange exchange ...... otherwise not have been this way continues, the final element is the largest exchange in the end, a trip to the bubble sort is complete.

Code
public void BubbleSort (int [] a, int n) {
     int temp;
     for (int i = 1; i < n; i ++) {
         for (int j = n - 1; j> = i; j--) {
             if (a [j - 1]> a [j]) {
                 temp = a [j - 1];
                 a [j - 1] = a [j];
                 a [j] = temp;
             }
         }
     }
}

Performance Analysis
The basic elements of the bubble sort comparisons with the input sequence to be sorted each element of the initial arrangement of nothing but the number of exchanges of data to be ranked with the initial arrangement of the elements, which may not exchange a best case, worst every comparisons need to exchange the case.
     
         
       
         
  More:      
 
- Squid proxy server configuration under Linux (Server)
- Ftp user to create multiple virtual machines to support different access rights Examples (Server)
- Linux system security check method (Linux)
- Open log in Hibernate (Programming)
- Upgrading Oracle 11.2.0.1.0 to 11.2.0.3.0 (Database)
- How to install Eclipse Luna IDE on CentOS 7 / RHEL 7 (Linux)
- Linux / UNIX: Use the dd command to create a 1GB size binary (Linux)
- Java string equal size comparison (Programming)
- Python when automated operation and maintenance often used method (Programming)
- Linux installation Jetty deployment under RedHat5 8 (Linux)
- Clojure programming languages: take full advantage of the Clojure plug-in Eclipse (Programming)
- ARM assembler instruction debugging method (Programming)
- Oracle 11g forget approach SYS and SYSTEM password (Database)
- shell script: a key to install LAMP, LNMP script (Server)
- Normal start Lazarus 1.0.8 under Ubuntu (Linux)
- Ubuntu and Derivative Edition users install LMMS 0.4.15 (Linux)
- Oracle Client Dedicated and Shared connection mode (Database)
- In Spring AOP example explanation (Programming)
- MySQL master-slave delay problem (Database)
- Linux Bash share tips for getting started (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.