I want to calculate user steps(like pedometer).I know that with iPhone 5s, 6 and 6+ we can use CMStepcount or CMPedometer or class(which use M7 chip of devices) but iPhone 5 and lower versions does not support M7 chip, so we can't use CoreMotion. By searching all over internet i came to know that we can use accelerometer sensor for this purpose. But after spending a lot of time still i'm not able to make an accurate algorithm that works.
If anybody worked for this kind of algo can you please share their knowledge or atleast give link of good resources so that can RnD.
Thanks in advance.

I'm not sure there is much we can help you with here. Part of the issue with algorithm development is the math and the logic. If you aren't strong with those, then you are going to have problems. Start by writing out the problem, and then your solutions, using plain language. Next, when you think you have the domain properly understood and a possible solution, write it out in computer pseudo code, along with the logic and math to support it. Be as detailed as possible. I think 90% of the time will be getting this to where you are sure you understand and have a solution to the problem. Only 10% will be writing the code. BUT DO NOT START WITH CODE!

commented: Exellent advice. +15