Amazon Interview Question for Software Engineer / Developers
- 0of 0 votes
Given a n-ary tree of resources arranged hierarchically. A process needs to lock a resource node in order to use it. But,- Prashi December 20, 2008
A node cannot be locked if any of its descendant or ancestor is locked.
I was supposed to
-> write the structure of node
-> write codes for
-> islock()- returns true if a given node is locked and false if it is not
-> lock()- locks the given node if possible and updates lock information
-> unlock()- unlocks the node and updates information.
Codes should be :
Lock()- O(log n)
unLock()- O(log n)
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Data Structures
Open Chat in New Window