GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
148 views
In a doubly linked list organization, insertion of a record in end involves modification of ____ for existing list.

one pointer

two pointer

multiple pointer

no pointer
asked in DS by Veteran (55.6k points)   | 148 views
Last node changes 2 pointer, new node to be inserted changes 4 pointers.

Total = 6 pointers. Right?
i think at last node only 2 poinetrs are modified for exsting links.

Adding new node address to last node next pointer and new node previous=last node address.

only 2 pointers are modified.

Yeah if we're talking about only existing link. Only 2.

Answer is one

Answer is correct --> 1 

Here question ask modification in existence link only which will be the last link -> right pointer updated to point new last link, though we also modify new last link -> left to point to original last link [which is now second last].  

what it was previously?

last_link -> right =NULL;

right?

Now,

new_last_link -> left= last_link -> right;

new_last_link ->right =NULL;

right?

Small edit. @shreya

new_last_link -> left = last_link; [ not last_link -> right ]

last_link -> right = new_last_link;

1 Answer

+2 votes

I think  modification of only 2 pointers is need .

1. Make it the last link 

2. Make pointer to the previous node.

 

answered by (415 points)  
ans: 1 pointer

Because in qus it is written that modification of existing list not the new node(not total modification if they ask total then ans will be 2 pointer).

In existing list we are modifying only last node next value.

Related questions

0 votes
1 answer
1
asked in DS by Arnab Bhadra Loyal (4.6k points)   | 63 views
0 votes
3 answers
2
+1 vote
1 answer
3
asked in DS by thor Boss (8.7k points)   | 64 views


Top Users Jul 2017
  1. Bikram

    5368 Points

  2. manu00x

    3092 Points

  3. Arjun

    1924 Points

  4. joshi_nitish

    1898 Points

  5. Debashish Deka

    1874 Points

  6. pawan kumarln

    1454 Points

  7. Tesla!

    1390 Points

  8. Hemant Parihar

    1314 Points

  9. Shubhanshu

    1136 Points

  10. Arnab Bhadra

    1124 Points


24,141 questions
31,143 answers
70,892 comments
29,467 users