GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
124 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 (53.8k points)   | 124 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

+1 vote

I think  modification of only 2 pointers is need .

1. Make it the last link 

2. Make pointer to the previous node.

 

answered by (305 points)  

Related questions

0 votes
2 answers
1
0 votes
1 answer
2
asked in DS by thor Boss (8.6k points)   | 57 views
+2 votes
1 answer
3
asked in DS by thor Boss (8.6k points)   | 139 views


Top Users May 2017
  1. akash.dinkar12

    3302 Points

  2. pawan kumarln

    1776 Points

  3. Bikram

    1646 Points

  4. sh!va

    1640 Points

  5. Arjun

    1396 Points

  6. Devshree Dubey

    1272 Points

  7. Debashish Deka

    1142 Points

  8. Angkit

    1044 Points

  9. LeenSharma

    1000 Points

  10. Arunav Khare

    754 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    732 Points

  2. Arnab Bhadra

    402 Points

  3. pawan kumarln

    402 Points

  4. bharti

    304 Points

  5. LeenSharma

    238 Points


22,822 questions
29,142 answers
65,209 comments
27,666 users