edited by
6,685 views
5 votes
5 votes

The following steps in a linked list

p = getnode() 
info(p) = 10 
next (p) = list 
list = p

result in which type of operation?

  1. Pop operation in stack
  2. Removal of a node
  3. Inserting a node
  4. Modifying an existing node
edited by

2 Answers

Best answer
13 votes
13 votes
It is Insertion of node ,

A node have 2 fields associate with it

1. Data ( The information that it conatin )

2 . Next --- ( which point to the next node )

The line P= get node () ; mean you are allocating a space for a new node that you want to create

Then you from second line info(p)=10 mean you are setting the info value to 10

And then you are updating list Field
selected by
6 votes
6 votes

get node will create a node then P will point to that newly created node

after info(p) will insert the value 10 inside that node

node p next part(which contains address of next node ) will then point to already existing link list named 'list' here

then list will point to node p...as a head..this is inserting a node at beginning of link list so, option is (c)

Answer:

Related questions

3 votes
3 votes
2 answers
1
makhdoom ghaya asked Apr 27, 2016
6,237 views
Which of the following number of nodes can form a full binary tree?8151413
9 votes
9 votes
3 answers
2
makhdoom ghaya asked Apr 25, 2016
9,183 views
In an array of $2N$ elements that is both 2-ordered and 3-ordered, what is the maximum number of positions that an element can be from its position if the array were 1-or...
10 votes
10 votes
2 answers
3
makhdoom ghaya asked Apr 25, 2016
8,445 views
The number of rotations required to insert a sequence of elements $9, 6, 5, 8, 7, 10$ into an empty $AVL$ tree is?$0$$1$$2$$3$
11 votes
11 votes
2 answers
4
makhdoom ghaya asked Apr 25, 2016
7,883 views
Let $A(1:8, -5:5, -10:5)$ be a three dimensional array. How many elements are there in the array $A$?$1200$$1408$$33$$1050$