Remove First Element In Linked List | FREE DSA Course in JAVA | Lecture 97

Поділитися
Вставка
  • Опубліковано 3 жов 2024
  • In this lecture, we are going to cover remove first operation of linked list which means we have to remove first element from the linked list.
    In order to do so, we have to delete the first node and get the head pointed to the next node.
    That's the simple operation that we need to cover to remove the first node in linked list.
    How we can do it?
    It's a simple 3 step operation where we can use a temporary head know as curr.
    curr = head
    head = head.next
    curr.next = null
    With this basic operation we will be able to remove the first element & node from the linked list.
    Let's see the code in java for the same operation.
    Check out the complete DSA course playlist - • Data Structures And Al...
    Subscribe ‪@TAPACADEMY‬
    For more information, fill out this form: forms.gle/8eiU...
    or call us at 8884881203
    Facebook: / thetapacademy
    Instagram: / tapacademy_online
    Linkedin: / 73820805
    Website: www.thetapacad...​
    #java #linkedlist #linkedlists #javaprogramming #coding #coder #javaprogram #itjobs #dsa #dsacourse #placement

КОМЕНТАРІ • 2

  • @saurabhchamoli5204
    @saurabhchamoli5204 Рік тому +1

    Is it necessary to write curr. next=null

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

      not required but it will be vanished by garbage collections in java.