User Posts: royal52
0
Selection Sort in Java with examples
0

Selection sorting is inefficient with a large number of unsorted data. As its name selection, it does the same. It get the lowest number from the unsorted list ...

0
Insertion Sort in Java with examples
0

Insertion sorting is very similar to bubble sorting, even in worst case the running time will be same. The key concept of insertion sort is similar to arrange ...

0
QuickSort in Java with examples
0

There are so many sorting technique / algorithm like bubble sort, merge sort, selection sort, quick sort, insertion sort etc. Quicksort is the mostly used ...

0
Polymorphism in Java with examples
0

Polymorphism is one of the core concepts of any Object Oriented Programing language. Polymorphism is Latin word and its meaning is that an object having a ...

0
Binary Search in Java with examples
0

In the world of computer science there are so many concepts and search is the one of the most important things. For example we have telephone directory without ...

0
Inheritance in java with examples
0

Java is Object-Oriented Programming. The core concept of OOPs programming is Encapsulation, Inheritance, Class, Object, Abstraction and Polymorphism. ...

0
Bubble Sort in Java with examples
0

Bubble Sort Java Algorithm:- Key Point is: Take a pair from the collection of item and compare. If they have wrong order swap them. Flow: Consider a ...

0
Two Dimensional Arrays in Java with Examples
0

In general, Array is a collection of the elements, where elements are of same data type. They are fixed in size. Array gives the random access of the elements ...

0
Loops in Java with Examples
0

Loops in java are also called iteration statements. Basically, there are three types of iterations statement in java. These are while statement do-while ...

0
Top 5 HP Laptops
0

Technology is advancing day by day and today the need for a laptop is must for everyone. Mostly, students and businessmen require it to complete their assigned ...

0
How to get Facebook page likes
0

Facebook is one of the best social media platform that provides you social interact with different people. It is also a medium through which you can publicize ...

0
Hidden Messages behind Famous Logo Designs
1

VAIO:- Although Sony has sold off its famous PC and laptop brand “VAIO” but the brand is still much popular and alive, you can purchase some amazing high ...

Browsing All Comments By: royal52
  1. just write if(array[j] lesser then array[j+1]) instead of if(array[j] greater then array[j+1]) and it will sort the array in descending order.

  2. I have updated my comment with a code block containing while loop, cheers.

  3. Okay, that’s the code of Bubble sort by using While Loop written in C++.

    while(i < 4) { int j = 0; while(j < 4) { if(array[j]>array[j+1])
    {
    hold=array[j];
    array[j]=array[j+1];
    array[j+1]=hold;
    }
    j++;
    }
    i++;
    }

    If you have any other questions then let me know, thanks.

  4. yes we can use a while loop.

  5. thanks for pointing out.

  6. thanks for pointing out !!!