How much background detail should go in the introduction section in a paper? I have been trying to write a paper. Reading the introduction part I am getting different behaviours from different papers. 

Some papers cover themselves more than 50% with introduction content as if they are the only source of information present anywhere while some give it very briefly expecting user to be well aware.

As a reader I never expected to learn the concept from paper intro part itself but from books and then read papers. I rather think that introduction section shall be used to provide very brief intro and references for further understanding. Repeating an algorithm that's present in 500 books makes no sense.

I need some tips on writing introduction part that its just about enough or is it mandatory to repeat info to make it somewhat complete in itself ?
How much detail to provide in the introduction depends on the circumstances.  The minimum requirement is to give enough context and references that a diligent reader could fill in any missing background, at the cost of some extra work.  However, that's a pretty undemanding requirement; a few papers fail to do this, but they generally fail by not even trying.  It's often valuable to do more to make life easier for the reader.  How much more depends on who you expect will read the paper, and on what you believe they want or need from the introduction.  (Some papers are read only by impatient experts, while others attract a broad audience.)  What's considered appropriate may vary between fields or even subfields, but here are a few general principles:


Targeting an audience for your papers can be a self-fulfilling prophecy.  If you aim at a very specialized audience, it becomes much less likely that anyone else will read your papers.  Attracting a broader audience is on the whole a good thing, both for scientific progress and for your own career, so it's best not to limit your audience unnecessarily.  If modest changes will make your writing much more accessible, then they are probably a good idea.
It's easy to overestimate how much readers really know.  In an ideal world, every researcher would remember all the details of everything they ever studied, but life doesn't work that way.  Of course you can't re-teach things from scratch (and shouldn't even try), but sometimes a brief reminder can be really helpful.  This is particularly true when the details matter: if the reader really needs to know exactly how a certain algorithm works to understand your paper, then restating the algorithm can be worthwhile even if you suspect most readers will already be somewhat familiar with it.  Those who already know the details can easily skim just enough to convince themselves that their version is the same as yours, while those who don't can read more carefully.
The introduction plays a crucial role in describing the context and explaining why you did these things and what the consequences are.  It may not be the part of the paper that most excites you, but it will almost certainly be the most-read section (not counting the abstract).  The purpose of your paper is to communicate your discoveries, and making the introduction more accessible is sometimes the best way to achieve this.