Binary Search Algorithm in C#

Поділитися
Вставка
  • Опубліковано 4 січ 2025

КОМЕНТАРІ • 54

  • @MilanJovanovicTech
    @MilanJovanovicTech  3 місяці тому +3

    Get the source code for this video for FREE → the-dotnet-weekly.ck.page/binary-search
    Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
    Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSth

  • @AslamNazeerShaikh
    @AslamNazeerShaikh 3 місяці тому +27

    Please make full DSA series in c# ❤🎉

  • @lalithmahadev5027
    @lalithmahadev5027 3 місяці тому +1

    So,you basically binary searched to the chapter of the book where you have contributed.Nicely done Milan!!!

    • @MilanJovanovicTech
      @MilanJovanovicTech  3 місяці тому +1

      I was the Tech editor 😅 But the writing is all Dino.

  • @fredericmerouze4876
    @fredericmerouze4876 3 місяці тому

    great video milan :) ! it's possible to have more content about Algorithm (binary tree etc) ?

  • @nouchance
    @nouchance 3 місяці тому

    Thank you MILAN!

  • @r75shell
    @r75shell 3 місяці тому

    Have you really tried to benchmark recursive version? Because if C# has tail-recursion optimization, it should produce same code as while loop implementation.

  • @haroldpepete
    @haroldpepete 3 місяці тому +1

    12:17 45 is greater than 40

  • @meharshahbaz2715
    @meharshahbaz2715 3 місяці тому

    Very conceptual video

  • @orestpavlenko565
    @orestpavlenko565 3 місяці тому

    Did you install some extension colors for intellisense or it could be setup in Visual Studio?

  • @CLeovison
    @CLeovison 3 місяці тому

    Hi Milan,
    I hope that you will release a video on how start making an minimal api in the future.
    Thank you thank you so much

  • @glickyaron9490
    @glickyaron9490 3 місяці тому

    great video. If it is possible to store the data in hash table. it will give a search complexity of O(1).

  • @danielbrown7534
    @danielbrown7534 Місяць тому

    is it an assumption when using binary search the numbers are in order? can it be used for objects?

  • @dhruvmathur5315
    @dhruvmathur5315 3 місяці тому

    Hey Milan, awesome stuff as always, can you please make a video on Durable functions please, I saw your video on azure functions and I think that's the next step no ?

  • @10Totti
    @10Totti 3 місяці тому

    Dino Esposito and Francesco Balena top software developer!!!!

  • @ЛюбомирГеоргиев-о5й
    @ЛюбомирГеоргиев-о5й 3 місяці тому +2

    Hi Milan, you have a bug in the Binary search code. This bug is very sneaky and widely speeded. Imagine input collection is with 2_000_000 elements and you are looking for the last element (or in upper part). When you sum left and right boundary the mid will overflow. There is very simple workaround using (right - left boundary) /2

    • @MilanJovanovicTech
      @MilanJovanovicTech  3 місяці тому +7

      @@ЛюбомирГеоргиев-о5й mentioned it in the benchmark part

  • @usEr-oCt-76
    @usEr-oCt-76 3 місяці тому

    But sorting is also part of the search which saves the time of the actual search.

  • @enricoroselino7557
    @enricoroselino7557 3 місяці тому

    yessss DSA

    • @MilanJovanovicTech
      @MilanJovanovicTech  3 місяці тому

      Should I do more?

    • @enricoroselino7557
      @enricoroselino7557 3 місяці тому

      @@MilanJovanovicTech yesss bring back the nightmare on BFS DFS or somesort, promise will takcle em this time 😂

  • @krccmsitp2884
    @krccmsitp2884 3 місяці тому +1

    I would've guessed that the compiler is clever enough to optimize / 2 to >> 1. Apparently it wasn't.

    • @MilanJovanovicTech
      @MilanJovanovicTech  3 місяці тому +1

      Explanation: x.com/andersforsgren/status/1827796305944416568

    • @michaldivismusic
      @michaldivismusic 3 місяці тому

      I'm guessing bit shift operations are scary for some people which might by why the compiler doesn't suggest this.

  • @sunzhang-d9v
    @sunzhang-d9v 3 місяці тому

    arr.for what is tool?

  • @onaspnet
    @onaspnet 3 місяці тому

    Your video thumbnail has a bug ... mid point is wrong ....

  • @henrik3098
    @henrik3098 3 місяці тому +1

    nice :)

  • @shoooozzzz
    @shoooozzzz 3 місяці тому

    YAAC (Yet another algo channel)

  • @fabaladibbasey7453
    @fabaladibbasey7453 3 місяці тому

    way to DSA