Java Playlist :

Hey guys, in this lecture we are going to study about Sorting Algorithms (Bubble Sort, Selection Sort)). Sit tight and enjoy the lecture. In case you face any doubt then you can ask your doubt from “Anuj Kumar Sharma Bhaiya” in the comment section or the above Instagram handle. #java. #selectionSorting #javaLanguage

Hi I am aman dhattarwal from another id

Why my negative values are not getting printed.

11:29 thanks me later

int a[] = {3,1,-2,4,0};

int n = a.length;

for(int i = 0 ; i<n-1 ; i ++) {

int minIndex = i ;

for(int j=i ; j<n ; j++) {

if(a[j]<minIndex) {

minIndex = j ;

}

}int temp = a[i];

a[i] = a[minIndex];

a[minIndex] = temp;

}for(int item : a) {

System.out.print(item + " ");

}

I did it the same way as he did but the and is coming wrong….pls help

sab kuch shi hai bas tumme samjhane ki capacity nhi hai

bhai itta speed kon beginner ko samjhata hai

hey look I completed 1k subs with the help of aman bhaiya support

great video ek baar mein pura samajh mein aa gya thank you so much

Koi pair programming mai interested hai kya? please reply me…. π

Marvellous Explanation of BubbleSort Sir! <3

Selection Sort :-

Minimum Index find karne wala Loop i ke vajah ( i+1) se start karege. Because every first time, the condition will be false.

So, no need to check it.

bhai please continue kro course wapas, dikkat arri hai

guys agar aap log bhi chahte ho yahi to please like kro taki aman bhai tk ye comment pahuche

bubble sort : 1:00

Selection sort : 17:15

Inner loop n-1 times chalna chahiye na

Anuj bhaiyyas's hey guys !!My name is anuj kumar sharma and welcome to apni kaksha toh aaj ki video me hum padhane wale hai…..Is refreshing as sunray in the winter morning!!π.

This bubble Sort approach is not performance-oriented. Below solution can sort array in the half time (compared to video's solution)

for (int i = intArray.length – 1; i > 0; i–) {

for (int j = 1; j <= i; j++) {

if (intArray[j – 1] > intArray[j]) {

int temp = intArray[j – 1];

intArray[j – 1] = intArray[j];

intArray[j] = temp;

}

}

}

When I try to run bubble sort program in my system the items of array comes vertically why is it so???

sir you told that you will solve the matrix multiplication problems!!!?

Why I<= n- 1 is false???????

Sorted kya chiizzz hai bhai…..? Declare to kiya nyu

Matrix multiplication by taking value from user explain……

Sir best book bata di jiya class 11 isc computer… practice ke liya..

Can anyone please explain why we always run loop to n-1?

For those who are searching for the Matrix Multiplication question from the previous video, here it is:

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("Enter Matrix Dimensions");

int rows = sc.nextInt();

int cols = sc.nextInt();

int a[][] = new int[rows][cols];

int b[][] = new int[rows][cols];

int c[][] = new int[rows][cols];

System.out.println("Enter Matrix 'a'");

for (int i = 0; i < rows; i++) {

for (int j = 0; j < cols; j++) {

a[i][j] = sc.nextInt();

}

}

System.out.println("Enter Matrix 'b'");

for (int i = 0; i < rows; i++) {

for (int j = 0; j < cols; j++) {

b[i][j] = sc.nextInt();

}

}

System.out.println("Result Matrix 'c' is");

for (int i = 0; i < rows; i++) {

for (int j = 0; j < cols; j++) {

for (int k = 0; k < rows; k++) {

c[i][j] += a[i][k]*b[k][j];

}

System.out.print(c[i][j] + " ");

}System.out.println();

}

}

bhaiya last video ka matrix multiplication wala question. disscuss chi kiya aapne hw wala. @Anuj Kumar Sharma Bhaiya

it may be more optimized by adding this lines –

if (a != minIndex) {

temp = arr[a];

arr[a] = arr[minIndex];

arr[minIndex] = temp;

}

abe bhai mere 4 bar toh swap kara selection me or tum bolre jitne elements utni swapping kri kya padhare ho yaar

bhai dhngse smjhaya kar jaldi jaldi me bohot kuch smjh ni aya

mera IndexoutofbondException error show kar raha hain if condition define kiya 14th line ko. why this showing error I'm not understanding.

Guys Aaap log First loop ko n-1 , ki jaga n-2 times chalaiye ho jayga run time aur bhi kam ho jayga

Will this swapping be on the bases of ASCII values?

Thank you

Okay what is minimum index

Sir selection Sort me bohot confuse he aapne board pe samjhaya samaj me aagaya but Coding me variable me. Confuse ho gaya iteration kab kese chal raha he i, j, minIndex yeh sab kis tarah se loop me change ho gaya konse loop me swap ho raha he I don't understand it clearly so plzz clear my doutss

Sir, selection sort thora confusing h answer to aa ra pr yad nhi hogi process

Bhaiya Aapne Kaha int minInd = i , lekin 'i' to outer loop ke liye Hain na basically iterations ke liye , to wo Kisi bhi value Jaise ki 5 ke equal kaise ho Sakta hai , inner loop ke liye to "j" hai wo inner loop mein values ko repeat krta hai na.

Bhaiya Aapne Kaha int minInd = i , lekin 'i' to outer loop ke liye Hain na basically iterations ke liye , to wo Kisi bhi value Jaise ki 5 ke equal kaise ho Sakta hai , inner loop ke liye to "j" hai wo inner loop mein values ko repeat krta hai na.

95 % doubt clear

.

.

5% not understood ππππ

Can anybody give answer for matrix multiplication …ππ

Pls subscribe to anuj bhaiya channel also to give him credits β€οΈ

22:33 for optimization , we can start the inner loop from i+1 , i.e , j=i+1 ,

Because , it will prevent to compare the same element

with itself .

Is insertion sort important?

Bhai mere me ArrayIndexOutOfBoundException bata q raha h

cant we initialize the inner loop from i+1 ??

Bhaiya aap iss video mein matrix multiplication dena bhul gaye.

Linear sort toh upar se nikal gya

Aman Bhaiya Make a video on how to install fossasia project on local engine.

Bhaiya at 20:03 why did you write 6,5 instead of 5,6

Was it just a mistake or it's a part of the algorithm?