Amazon Interview Question for Software Engineer / Developers
- 0of 0 votes
Create the n-ary tree from the ancestor matrix.- grave July 19, 2012 in India
matrix[i][j]=1 if i is the ancestor of j.
find the root (row with all zeroes).
Set the column with a[i][root] =0
find all the rows with all zeroes.insert into the tree all the children.and push all into the queue.
pop and find the children ,insert into the tree with popped node as parent and push into the queue.
Can not implement properly as it needed some modifications.
This is asked from my friend at amazon bangalore.
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays Data Structures Trees and Graphs
Interview Type: In-Person
Open Chat in New Window