The Gateway to Computer Science Excellence
0 votes
173 views
the sorage requirements of a linked stack with n elements will be what
in DS by Junior (853 points) | 173 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 (213 points)

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
50,647 questions
56,492 answers
195,439 comments
100,694 users