SantiagoYMG
BAN USERTake another array of same size.
push each word at the end of the new array.
Given Array.am i right
Result Array.
1. am
2. i am
3. right i am
@aayush
are the examples you have quoted, merge lists. Those two nodes are merge lists.
( Find the merge node of two linked lists where the rest of the nodes are same? is it correct meaning of the question, sorry if i am wrong)
@amustea, The assumption you made is both lists are unique. Is it a correct assumption. what if the lists are
A->B->C->D->C->D->E and
C->D->E
For each row
Mark the highest element into an index-array.
For each column
verify the least element in an index-array.
if already marked. Report the element.
else continue.
Nice
- SantiagoYMG December 01, 2011The problem can take huge memory and processor time if BFS is used.
My Initial assumption is to create groups according to some criteria(based on 'related' status).
Then find a path between groups of the person A and person B.
Then establish a path between the two groups, then between the two persons.
Now we have a path of some length between A and B.
Now we may try BFS between them , just to reduce the length between A and B.
I think its confusing, but my point is to establish a path between A and B and then reduce it to the minimum possible length.
RepI'm from India, 26 years old. I want to travel, I want a job where I can earn money ...
Take any person A let it be set S {a1,a2,a3};
- SantiagoYMG March 26, 2012Go to each person ax in set S.
if the ax has a know person he is not a celebrity.
else if ax knows none, then he is celebrity.
This methods can be done in time o(n). this is when the set S is considerably large ~n.
in an average case it should be of constant order.