L6. Job Sequencing Problem | Greedy Algorithm Playlist

Поделиться
HTML-код
  • Опубликовано: 16 июл 2024
  • Find problem link, notes here: takeuforward.org/strivers-a2z...
    Follow me on socials: linktr.ee/takeUforward

Комментарии • 34

  • @priyadarsimishra7909
    @priyadarsimishra7909 Месяц назад +22

    There is a slight error in the code. The inner for loop should start from j = deadline (arr[I].dead) till j >= 1 not 0. Because otherwise we are adding arr[0] but there is no day 0 to do work

  • @samitkumar18
    @samitkumar18 Месяц назад +20

    String please 🙏

  • @adarshmv261
    @adarshmv261 Месяц назад +10

    Day 0 or Time 0 should not be considered... As per the prob in GFG !!!

  • @siddharthchaudhary2320
    @siddharthchaudhary2320 27 дней назад +2

    Thank you striver for the yet another wonderful explanation.
    If anyone can tell how we can reduce the time complexity of internal loop to O(1) using DSU , please explain the logic. Thank you

  • @Dsa_kabaap
    @Dsa_kabaap Месяц назад +4

    Sir please start making videos on strings and stacks

  • @parthapratimhalder4888
    @parthapratimhalder4888 Месяц назад +6

    One thing I cannot understand why array of size 7 is taken where as max deadline is 6!!??

    • @anubhav0355
      @anubhav0355 Месяц назад

      for a job with deadline 6, you will put it into hash[6] right? so size of hash must be 7 for it to have 6 as valid index!

  • @animexworld6614
    @animexworld6614 Месяц назад +4

    Slightly mis typed Error in code It will be hash[ j ] = arr[i].jobid ... it will be hash of j not i

  • @KartikeyTT
    @KartikeyTT 17 дней назад

    tysm sir

  • @prathameshjadhav2942
    @prathameshjadhav2942 Месяц назад +1

    Understood

  • @user-iu3yl3hp8y
    @user-iu3yl3hp8y 19 дней назад +1

    Bhaiya, Strings aur Stack and Queue ki playlist kab laoge

  • @valiz2628
    @valiz2628 Месяц назад +1

  • @adarshjaiswal7334
    @adarshjaiswal7334 Месяц назад +8

    What is the concept of day0? The day should start with 1 right?

    • @divy04
      @divy04 Месяц назад

      same doubt

    • @priyadarsimishra7909
      @priyadarsimishra7909 Месяц назад +3

      I think it is to avoid like the deadline - 1 when changing value in hash, but the inner for loop should go from j = deadline to j >= 1 not till 0 because otherwise the output is not correct. I believe that is the error.

    • @nitjsrstudent5423
      @nitjsrstudent5423 Месяц назад +1

      @@priyadarsimishra7909 yeah u r correct

  • @World-Of-Mr-Motivater
    @World-Of-Mr-Motivater 9 дней назад +1

    striver ingeneral when speaking in an interview ,will you speak in 1.5x or 1 x speed?

  • @user-id9gq8op6t
    @user-id9gq8op6t 5 дней назад

    can you please change the song that you have added at the end of each video.....

  • @sumitmishra9795
    @sumitmishra9795 Месяц назад +1

    00:04 Solve job sequencing problem to maximize profit.
    02:15 Maximize profit by scheduling jobs with deadlines efficiently
    04:25 Maximize profit by scheduling jobs within deadlines.
    06:21 Maximizing profit by scheduling jobs based on deadlines.
    08:19 Job sequencing problem solved using Greedy Algorithm
    10:09 Understanding the comparator logic and sorting based on profit in job sequencing problem
    12:17 Iterating through jobs to maximize profit
    14:17 Optimizing job sequencing problem complexity and space

  • @anshulsharma3137
    @anshulsharma3137 Месяц назад +4

    Hi Striver, we can even use priority queue to optimize, basically choose only the maximum profit job from the jobs with the same deadline.

    • @dumpster-jackson
      @dumpster-jackson Месяц назад

      That will add extra O(n) space -> priority queue. Hence sorting will be better

    • @anshulsharma3137
      @anshulsharma3137 Месяц назад +1

      @@dumpster-jackson I have given the priority queue approach to further optimize the sorting solution from O(n*n) to O(n*logn) bro. Instead of using Dsu we can use priority queue to approach

    • @dumpster-jackson
      @dumpster-jackson Месяц назад

      @@anshulsharma3137 Good approach!!

  • @Professor-du2pf
    @Professor-du2pf Месяц назад +1

    cout

  • @Carson00_11
    @Carson00_11 Месяц назад +1

    Hello baby 🤗

  • @anuragmandal3136
    @anuragmandal3136 Месяц назад +1

    really cant understand anything he says

    • @adarshjaiswal7334
      @adarshjaiswal7334 Месяц назад +3

      You definetly will, Just don't quit for next 22 days!!