How to remove an item from a linked list within 30 seconds after the addition of? Hava you any idea ? This question I was asked at the interview.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you say ‘within’ do you mean any time? Or upon 30 seconds elapsing. If you’re trying to expire items then you need to put a timer somewhere.
You could create a kind of queue that moves items through at a fixed time (the expiration).
You could walk the queue continually, like a garbage collector, in which case the removal will be indeterminate.
Or you could put a timer on the item itself, started when you add the item to the queue, which signals the list when its time expires. The list could then remove the item.