Algorithms: What is Binary Search (Javascript)

preview_player
Показать описание
In this video I go over Leetcode problem 704 Binary Search. This is one of the most classic programming interview question. In fact I was asked this question in two of my interview. In order to solve this problem, I go over the concepts of Big O notations and explain why not all programs are equal. I also go through and solve the problem using an iterative approach and a recursive approach. I hope you guys enjoyed this video and continue to grid these problems out for your programming interviews :). Cheers

SECTION ANNOTATIONS ►
- 0:29: Problem Introduction
- 2:12: Big 0 Notations
- 6:36: What is Binary Search and How to Solve It
- 8:45: Iterative Solution
- 14:07: Recursive Solution

FOLLOW ME ON ►

MY FAVORITE JAVASCRIPT BOOKS ►
Eloquent JavaScript

JavaScript: The Good Parts

You Don't Know Js

MY FAVORITE JAVASCRIPT VIDEO RESOURCES ►

MY GEAR ►

PSA ►
Affiliate links help out the channel. I only link things that I have personally vetted myself. If you have gone through my links at all to buy something or learn something. Thanks so much for the tip :)
Комментарии
Автор

thanks for these vids, keep it comin!

daloshy
Автор

GOOD JOB. KEEP IT UP MAN! I LEARNED SO MUCH FROM YOUR EXPLANATION. THANK YOUU :)

nodemon
Автор

Why a + floor((b - a) / 2) and not just floor((a + b) / 2) ?

niFeforever
Автор

Why do recursive? It looks like a bit of extra work.

codingismyreligion
Автор

Hey man, i was trying to do if (l >= nums.length || r < 0) return -1 instead of if (l <= r) in your bst function but somehow it would always maximize call stack size. Not sure why it wouldn't be an alternate way to write your line 15 condition :/

daniellin
Автор

Hi Chon (or Chong...sorry, not sure how to spell you name! My apologies). First, thanks for explaining this tricky concept. It really cleared things up for me! Second, I have a question. I am running your code on my VS Code IDE and it seems to be acting buggy. It either gets stuck on an infinite loop when the floor and ceiling become equal or sometimes it exits after a few seconds. Any guidance or advice on how to avoid this buggy behavior?

fires
Автор

I've been going through your videos last couple of days and these are really great, but on this one you have a very repetitive music in the background and it drives me crazy :). It's way too distracting. I'm actually going to skip to the next one hoping it doesn't have it.

TheElijbet