Not Again (I Can't Sleep!)
Maybe because I'm not yet done with what I have scheduled for today. I still can't think of a better algo for Eskwela, the Birthday Updates.
Here's what's in my mind right now:
1) Let x be the list of users with birthday t.
2) Search all friends of (each element in) x. (Got the list of people, y, who will receive the birthday updates.)
3) For each y as m, get m's friends from x. (Now, I've got the list of m's friends with birthday t.)
Naintindihan nyo? Hahaha.. ang sakit sa ulo mag-explain. Hindi ko rin naintindihan. Basta parang ganun yung concept.
Any better algo?
Here's what's in my mind right now:
1) Let x be the list of users with birthday t.
2) Search all friends of (each element in) x. (Got the list of people, y, who will receive the birthday updates.)
3) For each y as m, get m's friends from x. (Now, I've got the list of m's friends with birthday t.)
Naintindihan nyo? Hahaha.. ang sakit sa ulo mag-explain. Hindi ko rin naintindihan. Basta parang ganun yung concept.
Any better algo?
1 Comments:
At 7:08 AM, Keith Weds Cha said…
I think you can do this in SQL statement depending on how you structured your database.
What i would do is write a cursor that selects all the users base on their birthdate -- say, a birthdate comingup in the next 7 days -- then write the update statement inside that cursor.
This is the easiest and most efficient approach.
Post a Comment
<< Home