newbie
BAN USER- 0of 0 votes
AnswersReverse n-Ary Tree and Return List of Leaf Nodes as Output
- newbie in United States for Google Plus
example
Tree will be like
1
/ | \
2 3 4
/ / \
5 6 7
/ \
8 9
out put will be 1st reverse the tree e.g. 2 points to 1 , 5 points to 2 , 8 poinst to 5 and so on for each node , without modifying the tree and then return list containing leaf node
as OutPut Head-> 8->3->6->9->NULL
do it efficiently , i saw a approach & code here but i think its not correct , guys can you make it correct ?| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersThere is a drought situation in Agrabah.King got worried and called Aladdin for helping him out. As he is a modern Aladdin he took printouts of places around Agrabah from google maps.For analyzing the map properly, he converted the map into a M x N grid. Each point is represented by either ‘0’ or ‘1’.
- newbie in India for Ads
‘1’ represents the unit area of water and ‘0’ represents the unit area of land. King told him to find the largest continuous patch of water so that he can send his people over there.
As our Aladdin is modern, but not a good programmer, he wants your help. Help him out by printing out the largest area water patch available on map.| Report Duplicate | Flag | PURGE
Directi Software Engineer / Developer Algorithm - 0of 0 votes
AnswersQ2 Sort a list of objects using the following comparison operator.
- newbie in India
isGreater(a,b)
+1 a>b
-1 a<b
0 The previous comparison is annulled. //it means we back to prev position isn’t it ?
write code efficient sorting| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm