GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
102 views
In double linked list organization, insertion and deletion of a record involves maximum modification of number of pointers respectively ___________________
asked in DS by Veteran (64.8k points) 35 220 622 | 102 views
4 nd 2 resp.

See the code

P---------->Q------------->R

P,R are 2 nodes, and in 1st code we are inserting Q

q->next=p->next;
p->next=q;
q->prev=p->next->prev;
r->prev=q->next->prev;

 

p->next=p->next->next;
r->prev=r->prev->prev;

Here in this 2nd code P,Q, R are 3 nodes, and we want to delete Q from it.

just a simple example to understand the code :)

plzz explain little more.. i m nt getting u...
if you just talk about modification of existing pointers then it should be 2 for insertion.

@srestha, I think for delete purpose also we need to update 4 pointers.

Considering your example, ptrs modified as follow

1. p.next

2. r.prev

3. q.next = null // Dangling PTR

4. q.prev = null // Dangling Ptr

1 Answer

0 votes
in insertion,Maximum number of modified Pointers=4

in deletion it is 2
answered by Veteran (20.4k points) 12 77 174

Related questions

0 votes
1 answer
1
asked in DS by iarnav Loyal (4.6k points) 4 36 111 | 91 views
0 votes
2 answers
2
asked in DS by smartmeet Loyal (4.8k points) 4 44 88 | 557 views
0 votes
1 answer
3
asked in DS by smartmeet Loyal (4.8k points) 4 44 88 | 69 views


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23240 Points

  2. Bikram

    17038 Points

  3. Habibkhan

    7096 Points

  4. srestha

    6008 Points

  5. Debashish Deka

    5430 Points

  6. jothee

    4928 Points

  7. Sachin Mittal 1

    4762 Points

  8. joshi_nitish

    4278 Points

  9. sushmita

    3954 Points

  10. Rishi yadav

    3744 Points


Recent Badges

Notable Question tajar
Notable Question Imarati Gupta
Notable Question set2018
Popular Question jothee
Notable Question set2018
Notable Question Pavan Kumar Munnam
Notable Question iarnav
Popular Question makhdoom ghaya
Popular Question Satyam
Popular Question radha gogia
27,254 questions
35,075 answers
83,756 comments
33,185 users