The Gateway to Computer Science Excellence
0 votes
195 views
the sorage requirements of a linked stack with n elements will be what
in DS by | 195 views

1 Answer

0 votes
Now we have a linked list containing n elements. Assuming it is singly linked list, for n elements we need n nodes right? now let us focus on 1 node.

1 node will consist of a value and a pointer to next node.

So total requirement of space for 1st node is ( size of memory needed for storing that value (Let it be x) + size of pointer(let it be y)).

THEREFORE TOTAL SPACE REQUIRED IS=NO OF NODES*SIZE OF EACH NODE=N(X+Y).
by

Related questions

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
52,315 questions
60,427 answers
201,756 comments
95,233 users