#16 - What is TreeMap? HashMap vs TreeMap || What is Red-Black Tree (Implementation of TreeMap)

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

КОМЕНТАРІ •

  • @KevindraSingh
    @KevindraSingh 3 роки тому +21

    This video is missing the whole core concept of R/B tree to balance the nodes to maintain a log(N) height. What you explained in this video is only the BST concept.

  • @socialmedia434
    @socialmedia434 4 роки тому +36

    Hi Naveen, I am not clear about the Red And black Nodes. How do you mark a node as red? or black?

  • @spk9434
    @spk9434 4 роки тому +13

    Best video on TreeMap. One observation - Red-black tree is a balanced Binary Search Tree not just balanced Binary Tree.

  • @olive5532
    @olive5532 3 роки тому +3

    Thanks for the video. But I think the example at 21:10 is not a Balanced BST. Am I incorrect?

    • @Subeg7aryal
      @Subeg7aryal 10 місяців тому

      Yeah, it is not balanced. The right side of James is Paul . From Paul left is Larry and right is Ted

  • @KaushalKumar087
    @KaushalKumar087 3 роки тому +1

    These kind of problems should never be asked in an interview. TreeMap is available in the Java library only. People using other languages will have hard time implementing TreeMap from scratch ans solving the problem also in 20-30 minutes interview.

  • @poonamsharma7026
    @poonamsharma7026 3 роки тому +1

    Great explanation. Thanks for your efforts :).

  • @mahammadkhaja9478
    @mahammadkhaja9478 2 роки тому +1

    everything is good, but got ambiguity in which node has to mark as red, which node has not to?

  • @rajasekharb7901
    @rajasekharb7901 3 роки тому +3

    Good explanation and appreciated!.. But in this tutorial you didn't mentioned how to decide which node is black and which node is red. This is normal true you explained!..

  • @beemaraju
    @beemaraju Рік тому

    Hi Sir, Its clear for now. but i couldn't understand if suppose if two names are similar how the tree will be sorted?

    • @aleksandrefimov8754
      @aleksandrefimov8754 Рік тому

      TreeMap doesn't allow duplicate keys and as tree is built bases on keys there will no be two similar keys.

  • @ShivamKendre-fc3su
    @ShivamKendre-fc3su Рік тому +1

    great explained

  • @olala-j7g
    @olala-j7g 2 роки тому +1

    Bro you are the best thing i found on youtube in first part of december

  • @arvindkumargupta8856
    @arvindkumargupta8856 10 місяців тому

    we have added value like
    map.put("arvind",100);
    map.put("And",90);
    map.put("duck",100);
    map.put("C",98);
    output-key=And
    key=C
    key=arvind
    key=duck
    if key is getting sorted based on alphabet then why we are getting ouput wrong ....could you please tell me

  • @EternalTwilight29
    @EternalTwilight29 3 роки тому

    Hi Naveen, i m getting error while trying to use TreeMap --- The type TreeMap is not generic,it cannot be parameterized with arguments . Can you please explain why i'm getting like that :(

    • @ramiyamp
      @ramiyamp 3 роки тому +1

      If you have given class name as TreeMap(). then it will conflict with Java.util.TreeMap. Try changing the class name.

  • @manichowdry547
    @manichowdry547 4 місяці тому

    Excellent

  • @ashuiet
    @ashuiet 4 роки тому +2

    Superb ..!!!

  • @arnavpatil583
    @arnavpatil583 4 роки тому +2

    Very easily explained

  • @rahulsoni-lx5rb
    @rahulsoni-lx5rb 3 роки тому +1

    🙌🙌🙌awsm

  • @samiulislamdurjoy
    @samiulislamdurjoy 2 роки тому

    G 0:12

  • @sainathvallampatla5135
    @sainathvallampatla5135 3 роки тому

    Iwas asked in an interview about printing the Treemap in reverse order.

  • @priyankabakshi9765
    @priyankabakshi9765 3 роки тому

    Hi Naveen,
    Thanks for the video. Please let me know if we can have customized objects as keys in treemap? If yes, how would we do the sorting?

    • @lakshbk
      @lakshbk 3 роки тому

      You will have to implement equals and hashcode method and pass a comparator

  • @baubaudinamo
    @baubaudinamo 4 роки тому +1

    Great job!