Java Program #21 - Sort Numbers using Bubble Sort in Java

preview_player
Показать описание
Java Program to Sort Numbers using Bubble Sort Algorithm | Programming for Beginners
In this video by Programming for Beginners we will learn to write Java Program to Sort Numbers using Bubble Sort Algorithm, using Java Tutorial videos.
This Java program is very important for your Java interview questions or if you are learning Java Programming language as a student.

Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order.
This algorithm is suitable for small data sets.

Example:
Input: arr[] = {5, 1, 4, 2, 8}
Output: arr[] = {1, 2, 4, 5, 8}

==========

Java Tutorial for Beginners Playlist:

All Java Programs Playlist:

We can learn Java Programming language to make web applications or mobile applications for android phones and several other applications for windows, Mac OS and Unix operating systems. Also we can make android applications using Java programming. The concepts covered will be related to basic java and core java that will help you in your next interview questions. You can use any version of Java but all concepts will be same for all java versions. I will be using Java SE 8.
Java is a high-level programming language. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.
Java is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Software Development Domain.

Java JDK:
Eclipse IDE:

YouTube Gears:

#JavaProgram #JavaTutorial #Programming #Java

============================
LIKE | SHARE | COMMENT | SUBSCRIBE

Thanks for watching :)
Рекомендации по теме
Комментарии
Автор

On God, this is the best solution i have seen till now🔥🔥

lukearnold
Автор

Thank you soo much ! Very well explained brother. Keep it up ! Already Subscribed to you channel. Love from Mumbai <3

parkergaming
Автор

Thank you so much! hope I can learn more from you sir.

pelayojhonmeltonmanio
Автор

Thanks sir your video helped me so much

kelaketa
Автор

Bro, please explain why did you write for loop with i again in the end?

pnprashant
Автор

Thank you so much, good explanation ❤️

tharinduminiruwan
Автор

sir when I tried the code by myself, the code number line 8 of ur code where " j< length -i", where the "i" is used because you said we dont want to swap the last element during the 2nd iteration. but when I tried the code by myself I noticed if I just wrote "j < length" it gives me the same result sorted in ascending order without the last element touched. so is it valid??

faisalshafiuddin
Автор

Its very hard to understand the for loops.
I undertand what bubble sort is. But the code itself i cant understand

gosuace
Автор

how about from highest to lowest output? badly need.

yqiwndbduebkdne
Автор

In if condition why we need to take (arr[ j-1 ] >arr [ j ] ).

Why we should not take ( [ j-1]>[ j ] ) by removing arr before j-1& j

User-fh