Skip to main content

Posts

Showing posts from November, 2006

Parents... What do they mean to you ?

Alsalam alikom wa ra7mat allah wa barakatoh What do ur parents mean to you ? The "default" answer is "the whole world.." but have you thought about it a little bit... Are you ready to scarify urself for them ? don't answer quickly.. think more.. Are you ready to leave ur job for them ? again, no quick answers.. Are you ready not to buy ur car that u have been saving for 3 years to give them that money as they need it ? Are you ready ... Are you ready ... Hope you are... Because for me, I thought a lot.. I thought about all what I did to them and all what they did for me...... they r just incredibles.. For me, I'm ready to do whatever they want... I pray not to make them angry at all... Mom, Dad, I have nothing to say but "I LOVE YOU" Alsalam alikom wa ra7mat allah wa barakatoh

Q Matrix... Dynamic is not always the solution...

Alsalam alikom wa ra7mat allah wa barakatoh Today I'm going to speak about a useful (I hope) piece of algorithm, that makes ur life easier ;).. Let's re-visit the Fibonacci Series, F(n) = F(n-1) + F(n-2) Till yesterday, I knew only the dynamic solution for it (Top Down and Bottom Up) long long fib(unsigned int index) { if (index < 0) return 0; if (sol[index] != -1) return sol[index]; return fib(index - 1) + fib(index - 2); } looks neat, huh!! so, what if I ask u to give me the answer of fib(1000000000) ? this will require in the best case to have 1000000000 iterations which is O(n), mmmm bad!! Let's see the second solution (using Q-Matrix) Some math first : Q: What do you need to calculate fib(n) ? A: fib(n-1) & fib(n-2) so, if we re-wrote the relation between inputs and output like this : [fib(n-1), fib(n-2)] * [1, 1] = [fib(n-1) + fib(n-2), fib(n-1)] which is [fib(n), fib(n-1)] [1, 0] that last vector is suitable t

National, Local, Coming..... ACM

Alsalam alikom wa ra7mat Allah wa barakatoh Hope everybody is just fine.. I was writing since the last Local Contest ( 28th-October-2006 )... but today I decided to delete my Draft and to write a brand new post... I'll not write informative or advices here, at least not in this post... Today, the contest was scheduled to start at 11:00am but it started after the prayer, maybe at 12:00 or maybe after that... The contest was challenging, but we didn't solve a problem till 45minutes (which is bad), we were in a late position, then we started to solve problems... After about 2 hours of the contest, we were in the 7th position (having 2 problems solved I guess) while the first & second have 4 problems solved, then we were debugging in 2 problems then.. when we got a solution to one of them and got AC.... we spent 2:30 hours between those last two AC (which is bad).. The board is frozen having FCI-1 in the first position, AUC in the second position both with 5 problems solved...

10 Worst things to do in a Meeting...

Alsalam alikom wa ra7mat allah wa barkatoh Today, I came across this article (Which was sent to me by my sis) and I thought to keep it online... for archiving purposes ;) 10 Worst Things to Do in a Meeting By Kate Lorenz, CareerBuilder.com Editor Meetings have been hailed as the No. 1 time-waster in corporate America, and -- unless food is served to offset the boredom -- the most tortuous part of the work day. Who among us hasn't cringed as the office windbag launched into a self-aggrandizing discourse that was completely off-point? Pitied a meek co-worker who got trounced by the office bully? Or marveled at a colleagues' ability to string together an array of buzzwords that mean absolutely nothing? Yet no matter how mind-numbing things get, don't be lulled into thinking that meetings aren't important. The fact is, they can make -- or break -- your career. Here are 10 things you should never do in a meeting: 1. Show Up Late. Nothing says "I'm disorganized&quo

When Foreach is faster than Traditional For

Alsalam alikom wa ra7mat Allah wa barakatoh Today, I was checking on of my friends' blogs Mohammed Hossam , when I found that post about List .Foreach function, then I read this article Did it With .NET ... So, what is this all about !! I'll talk about two aspects, 1- The use of it.. 2- The Performance Issue.. - The use of it : Consider this program : foreach (int i in arr) { Console.WriteLine(i); } This looks neat enough.. but mm, what about this : arr.ForEach(delegate(int i){ Console.WriteLine(i); }); or what about this : arr.ForEach(i => Console.WriteLine(i); ); or what about this : arr.ForEach(Console.WriteLine); Looks nice, huh ;) ? List .ForEach accepts as a paramater, a delegate object that takes type .. u can do whatever u want inside this delegate, and it'll be applied on each element of the List. About the second example, i =>, this is just a sample for Lambda expression... The third looks really neat actually, I really liked it... 2- The Performance

Police at your service...

Alsalam alikom wa ra7mat allah wa barakatoh Hope everyone (or let's say everyNoOne) is just fine.. Today, I had a very strange experince. After the exams we had today, we went out of the college toward where my sis's friend parks her car, we went.. and found mm NO CARSSSS, there is not a single car... the first car we saw was far from that place... we went there searching for the car, one of the Buses' drivers told us that the Militry Police (who has a building near by) has came and left all the cars that were here... (It's going more fun.. hah) After some questions to people there, they told us to go to a place (beside a bridge) and we "may" find the car there... We went, and (as expected) we didn't find the car.. we asked some Militry Soldiers there, they guided us to -so called- their centeral building. We went and they were "shocked". The Soldier : No cars came here... Us : So ??? The Solider : I don't know (who should know then!!!) Us (g