Even if assuming the allocation is uniform.
Knowing the address of previous node is the limitation on SLL in constant
time.
Also, if we know the address of previous node. we are done. But, finding it
will take O(n) time.
On Wednesday, 11 July 2012 03:36:46 UTC-4, invictus wrote:
>
> Well, we can
Well, we can do one thing but it might not work in all cases.
First of all you need to know the node structure. Assume it has an int and
a next pointer.
Assumption - Memory allocation for nodes did not happened at random
location but uniformly.
1. Find out the memory address contained in the n
The constant time removal of last node in a SLL is the limitation of
approach you have in mind.
-- I read it in somewhere (may be Cracking Coding interview 4th edition)
if we have access to head.. then.. its the trivial O(n) time.
On Monday, 9 July 2012 16:06:17 UTC-4, subharansu wrote:
>
> Is t