I don't know how to thank you . We are paying money in lacs to college still they don't teach anything. But you are giving us these amazing explanation for free. Thank you so much brother. Keep making videos
I went over leetcode explanation, did not get it. Then i went over few of you tube videos where they just solved the question giving minimal explanation. Then i bumped on this. Thank you so much brother. I was trying to understand DFS practically and this pretty much sums it out for a beginner like me. Thanks a bunch again.
thank you so much! I love your teaching style. Although many RUclipsrs did algorithm videos, some of them started coding at first without exquisite explanations, so I can't follow them. Thank you again bro.
@@techdose4u but you told in the video the time complexity as O(n). Since we are using dfs for each element, so the time complexity must be greater than O(nxm).What's your opinion? Please clarify it if i am wrong
@@abhishekjaiswal6492 asume if it's O(m*n) than N = m*n then complexity is O(N) which is again linear time so instead of writing O(m*n) we can directly say it's of O(n)
awesome bro... Another method I thought was to first find the indices of all the 1's and store it in list l. Then traverse through the list in dfs and keep on removing the elements from the list l if found ... But 😅one of the test case went out of time...46/47.
This is good explanation, suppose if going diagonally is also allowed . then will this work if we just add these 4 more directions to the existing 4 directions mark_current_island(matrix,x-1,y-1,r,c); // LEFT UP DIAGONAL mark_current_island(matrix,x-1,y+1,r,c); //RIGHT UP DIAGONAL mark_current_island(matrix,x+1,y-1,r,c); //LEFT DOWN DIAGONAL mark_current_island(matrix,x+1,y+1,r,c); //RIGHT DOWN DIAGONAL
Java Code is below ============ public class NoOfIlands { public static void main(String[] args) { int noOfIlands = 0; int map[][]= {{1,1,0,0,0},{1,1,0,0,0},{0,0,1,0,0},{0,0,0,1,1}}; int height = map.length; int width = map[0].length;
Thank you, I am so afraid to start any problem that I even couldn't sum two diagonal problem which is easiest. Having around 7 yr of experience as web developer but they way you explain and the code you show made me little confident that logic is most important in this problems
I don't know how to thank you . We are paying money in lacs to college still they don't teach anything. But you are giving us these amazing explanation for free. Thank you so much brother. Keep making videos
Thanks bro :)
well said man.
@@johnwick-gj9gb yup he deserves it
just say "T H A N K Y O U ! ! !" XD
in reality colleges have become randi khhana..u go and pick a girl
Your way of solving problems is easy to understand .. thank you for such a nice contents.
Welcome :)
I went over leetcode explanation, did not get it. Then i went over few of you tube videos where they just solved the question giving minimal explanation. Then i bumped on this. Thank you so much brother. I was trying to understand DFS practically and this pretty much sums it out for a beginner like me. Thanks a bunch again.
Welcome bro :)
You explain way better than some youtubers with thousands subs. Thank you, dude! Keep doing
Thanks :)
dude, you are the best teacher out there!!. Can call you as "Teacher" with out any spelling mistake!!
That's an extraordinary explanation mate. You made it look so simple. Thanks a lot.
Welcome 😄
Literally u made be this question a cake walk for me . Never studied DFS but your Clear voice filled with knowledge taught me everything
Great solution, and using the graph itself to store the visited state is a big brain move.
👍🏽
I like your videos. You explain everything without skipping steps
good explanation, found a Indian programming tutorial gem :).
In 2022. This video had a the best explanation for this problem, handsdown! :)
thank you so much! I love your teaching style. Although many RUclipsrs did algorithm videos, some of them started coding at first without exquisite explanations, so I can't follow them. Thank you again bro.
Welcome :)
There are so many videos on youtube for this problem. Your explanation is the best 🍻
Thanks bro :)
Thank you for this crystal clear explanation! I could not follow other explanations found on the internet, but this was very clear.
I think the time complexity should be O(n * m) as we are traversing the whole matrix
Yes.
@@techdose4u but you told in the video the time complexity as O(n). Since we are using dfs for each element, so the time complexity must be greater than O(nxm).What's your opinion? Please clarify it if i am wrong
please reply
@@abhishekjaiswal6492 each recursive we will do maximum O( 1) work , so I think it's O(nm) , maybe it is > O(nm)
@@abhishekjaiswal6492 asume if it's O(m*n) than N = m*n then complexity is O(N) which is again linear time so instead of writing O(m*n) we can directly say it's of O(n)
THE BEST explaination.
Thanks :)
Great explanation with simple and efficient solution.
please make video on other graph algorithm.. your way of writing code and explaining is crystal clear.
Thanks...will do it soon
it is a blessing to have found your channel
:) when did you find it actually?
TECH DOSE recently not sure exactly when 😄
Thanks, TechDOSE for this amazing graph series...thanks a lot...
Welcome
Thank you very much! You have a way of explaining things that makes it very easy to understand 👏🏾👏🏾
:)
awesome bro...
Another method I thought was to first find the indices of all the 1's and store it in list l.
Then traverse through the list in dfs and keep on removing the elements from the list l if found ...
But 😅one of the test case went out of time...46/47.
Nice..... This technique is something different.
Simply wow, one of the best solution.
Thanks :)
You always give us the best explanation, Thank you!!!
Welcome :)
No Words you are Awesome and Genius.. keep doing good problem vedios
Not genius...just consistent work :)
it was literally a crystal clear explanation for this question
thanku TechDose
u just made my day.....
The best explanation. I have wasted 1 hour just by seeing other videos
Waiting for disjoint set implementation of the above problem.
Btw Nice explanation! Thank you!!
Sure 👍🏼 Thanks
This is good explanation, suppose if going diagonally is also allowed . then will this work if we just add these 4 more directions to the existing 4 directions
mark_current_island(matrix,x-1,y-1,r,c); // LEFT UP DIAGONAL
mark_current_island(matrix,x-1,y+1,r,c); //RIGHT
UP DIAGONAL
mark_current_island(matrix,x+1,y-1,r,c); //LEFT DOWN DIAGONAL
mark_current_island(matrix,x+1,y+1,r,c); //RIGHT
DOWN DIAGONAL
nicely explained and presented, thank you.
i recently started watching referring your videos. This one is amazing. Such a clear and neat explanation! Thank you for this.
Welcome 😀
Amazing level of explanation and speaking
Thanks
Java Code is below
============
public class NoOfIlands {
public static void main(String[] args) {
int noOfIlands = 0;
int map[][]= {{1,1,0,0,0},{1,1,0,0,0},{0,0,1,0,0},{0,0,0,1,1}};
int height = map.length;
int width = map[0].length;
for(int i=0;i
Beautifully explained!! Thank you very much for this!
Welcome :)
OMG! Thanks!!!! Please Continue!!!!!!!!!!!!!!
You made this problem as easy as addition of two numbers!! Amazing explanation.
Thanks :)
really nice explanation is an easy efficient way thanks a lot
Welcome :)
Great little tutorial, simplified the problem for me
Thanks 😄
Awesome ❤
very clear, visual, and direct explanation. Thank you, bro.
Welcome :)
You are AMAZING!!!! Best and Simple Explanation!! I am kinda falling short of words! 😀 Thanks Bro.
Very calm explanation
Thanks
your explanation technique is awesome.
Thanks :)
best teacher best youtuber thank you sir😃😊
Welcome :)
Couldn't have been more clearer.Thanks for it :)
Welcome :)
very nicely explained
Your content is really good.
Easy to understand and it helps us to code based on that understanding.
Please continue making videos.
Thank you.
Welcome
Awesome Explanation Sir .
Thanks
Thank you so much!! I finally understood the problem!
Your explanation is no fire 🔥🔥🔥🔥🔥🔥
thanks for the amazing explanation. I was unable to find a good video but u explained very well.
I have a benefited a lot from your videos, keep up the good work!
Nice :)
excellent explanation
Best explaination
Thanks :)
Awesome , top notch explanation. Thank you!
Awesome Explanation. Thanks Sir!
Sir really super amazing no words to express my happiness keep it up sir
Thanks :)
Thank you, I am so afraid to start any problem that I even couldn't sum two diagonal problem which is easiest. Having around 7 yr of experience as web developer but they way you explain and the code you show made me little confident that logic is most important in this problems
keep it up ..
welldone
Thanks :)
your content helping a lot.....Upload daily more and more problems❤
Thanks :)
Short and concise 👌👌👌👌
👍🏼
good explaination
wonderful explaination
Thank you for very easy way explanations
Thnaks sir today i take dose of this question😂😅😅😅
Thank you, bro, for this clear explanation. 👍
Welcome :)
simple n best explanantion
:)
Best explanation
Thanku so much :)
Welcome :)
Nice explanation. Thanks
Welcome
good explanation
Superb man! Thanks, for your help.
Welcome :)
The time complexity is O(m*n). Also it's better to use stack instead of recursion.
Our good deeds come back to us, I hope that someday I will be able to pay you for this wonderful explaination..........++Thankyou:)
😊
Matlab bhai tum kaam 1 No. kar rahe ho...bas itna hi kehna chahta hun
Thanks bhai :)
Excellent.. You explained it well...
Thanks :)
Excellent solution
Thanks :)
Thanking you sir 😊☺️.. to make this problem easy to understand 😊
Welcome :)
great way of doing things ..awesome man
Thanks :)
thanks guru ji
Welcome :)
Javascript code:
function Numberofislands(array) {
let island = 0;
for (let row = 0; row < array.length; row++) {
for (let col = 0; col < array[row].length; col++) {
if (array[row][col] === 1) {
array[row][col] = 2;
island++;
if ((array[row][col - 1] && array[row][col - 1] === 2)
|| (array[row - 1] && array[row - 1][col] && array[row - 1][col] === 2)
|| (array[row + 1] && array[row + 1][col] && array[row + 1][col] === 2)
|| (array[row][col + 1] && array[row][col + 1] === 2)) {
island--;
}
}
}
}
return island;
}
more specifically this is problem can be described as , find all of the connected component in the given graph.
True :)
amazing explanation! thankyou
Welcome :)
Glad you made this video! great explanation.
Thanks
Thanks!
Nice Explanation : )
Thanks :)
Thank you for your video!
Thankyou very much. Can't thankyou more!!
best explanation
Thanks :)
Thank u so much , all thanks for the way you solve , very easy and understandable, really thanks a lot.
Welcome :)
Thank you, this was helpful :)
Can not thank you enough for the wonderful explanation.
Welcome :)
Thanks man! It was just what I needed.
great explanation thanks
well done!
Very Well expained sir ! thank you !
Welcome
Awesome!!! Subscribed😅. Keep them coming.
Thanks :)
Awesome explanation! Thank you!
Welcome :)
Thank you so much for a detailed explanation 🙂
Welcome :)
Well Explained
Thanks :)
Amazing explanation, sir 🙏
Thanks ☺️