The Gateway to Computer Science Excellence
+6 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.
in DS by Boss (30.8k points) | 3k views

1 Answer

+11 votes
Best answer
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
by Loyal (9.9k points)
selected by
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
50,737 questions
57,297 answers
104,977 users