Doubly Linked List (Insertion between the Nodes) - Part 2

Поделиться
HTML-код
  • Опубликовано: 24 окт 2024

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

  • @tejatej3628
    @tejatej3628 4 года назад +10

    Thank you sir for your quick response. Best ds tutorial

  • @prajwalgowda6206
    @prajwalgowda6206 3 года назад +2

    This channel as been my all time fav

  • @techienomadiso8970
    @techienomadiso8970 2 года назад +1

    Short, precise and very Informative! Great content this is 💯💯💯

  • @102ayushkumar3
    @102ayushkumar3 3 года назад +1

    node* addAtPos(node* head, int data, int pos){
    node *temp=malloc(sizeof(struct node));
    temp->prev=NULL;
    temp->data=data;
    temp->next=NULL;
    if(pos==0){
    temp->next=head;
    head->prev=temp;
    head=temp;
    return head;
    }
    else{
    node *tp=head;
    int i=0;
    while(i++!=pos-1) tp=tp->next;
    temp->next=tp->next;
    tp->next=temp;
    temp->prev=tp;
    return head;
    }
    }
    I did this on my own. works well for all positions.

  • @SusheelKumar-dq7np
    @SusheelKumar-dq7np 3 года назад +7

    Sir , last node prev part value is 4000 so plz replace 2000 to 4000 sir....

  • @sejalbahirat1616
    @sejalbahirat1616 2 года назад +1

    Thank you so much neso academy. This is helping me alot with my studies 💯 excellent series!!!!💯💯

  • @prateekbaheti8236
    @prateekbaheti8236 4 года назад +3

    As usual, AWESOME.....🙏🙏🙏🙏

  • @Adityasharma-oe8zp
    @Adityasharma-oe8zp 3 года назад +2

    Sir, why you've put that semicolon after the closing bracket of function???

  • @sejalbahirat1616
    @sejalbahirat1616 2 года назад +2

    temp2--> prev = newP so shouldn't 2000 in prev be change to 4000? In the vid it's still 2000 and haven't been changed

  • @prateekbaheti8236
    @prateekbaheti8236 4 года назад +1

    Sir please complete this series as soon as possible....

  • @_nabin_8848
    @_nabin_8848 7 месяцев назад

    To add new node at the beginning of the list, you have used if clause to update the head, but it won't get reflected in main function.

  • @nandansayyappan9482
    @nandansayyappan9482 10 месяцев назад +1

    Why are we doing before and after a specific position instead of like what we did with normal linked list ?

    • @big-jo89
      @big-jo89 9 месяцев назад

      I believe for the sake of breaking down the concept for the students to fully absorb it.

  • @ThePet09
    @ThePet09 2 года назад

    We also can changeIn previous code and every thing same-while(pos != 2)

  • @samyserafina3
    @samyserafina3 2 года назад

    Thank You for making this presentation sir

  • @biswajeetdehuri4952
    @biswajeetdehuri4952 2 года назад

    best playlist!

  • @dipeshsamrawat7957
    @dipeshsamrawat7957 3 года назад

    I love Neso Academy :)

  • @tpa02
    @tpa02 Год назад

    temp->prev=newp;
    temp->prev=4000;

  • @niteshtiwari8767
    @niteshtiwari8767 Год назад

    what is the difference on while condition is different in part 1 and 2 is it necessary to change the condition?

  • @umutaydn6184
    @umutaydn6184 7 месяцев назад

    Why are we returning head in the addBeforePos function?
    We are not changing the value inside the head pointer.

  • @abhishekanand9430
    @abhishekanand9430 Год назад

    you are best

  • @tonystark7806
    @tonystark7806 4 года назад

    When this Course will complete fully??

  • @SusheelKumar-dq7np
    @SusheelKumar-dq7np 3 года назад

    That is temp2 prev part value 4000

  • @ARMINK6969
    @ARMINK6969 4 месяца назад

    In this program position is fixed

  • @gautamgarg7377
    @gautamgarg7377 3 года назад

    Nice.

  • @tahreemriaz2401
    @tahreemriaz2401 3 года назад +1

    Sir plzz can you provide us the whole code which you describe
    Plzzz Sir

  • @krb4264
    @krb4264 Год назад +1

    Here is my code with no need of two temp pointer:
    void addAtPosition(Node *head, int data, int position)
    {
    Node *newNode = (Node *)malloc(sizeof(Node));
    Node *temp;
    temp = head;
    if (position == 1)
    addAtBeginnning(head);
    else
    {
    while (position > 2)
    {
    temp = temp->next;
    position--;
    }
    newNode->data = data;
    newNode->next = temp->next;
    newNode->prev = temp;
    temp->next = newNode;
    newNode->next->prev = newNode;
    }
    }

  • @avirupmazumder4840
    @avirupmazumder4840 3 года назад

    What to change in this code for user input ?

  • @SubhamoyMaity-v8c
    @SubhamoyMaity-v8c Год назад

    Sir, this code is not printing if we pass pos =1 😟😞.

  • @ani_graphy03
    @ani_graphy03 Год назад +1

    I cant differentiate between part 1 & 2

    • @aditisamargade1307
      @aditisamargade1307 Год назад +1

      1 part is about inserting a node after a specific position for which the condition in while loop was (position !=1) and part 2 is about inserting a node after a specific position for which the condition in while loop is (position > (position -1))

    • @ani_graphy03
      @ani_graphy03 Год назад +1

      @@aditisamargade1307 thanks! I found out.

    • @niteshtiwari8767
      @niteshtiwari8767 Год назад

      ​@@aditisamargade1307 I am little confused. what is the difference in part 1 and part 2 i can't understand

    • @_nabin_8848
      @_nabin_8848 Год назад

      part 1 is about inserting new node after the given position and part 2 is about inserting new node before the given position.

  • @subhajitchoudhury4981
    @subhajitchoudhury4981 2 года назад

    please give us the source code sir