This. The more times you learn something, the more it will stick in your head. So whenever you do something new, especially when you find it difficult or annoying, do it more when you get home.
Summarise the entire textbook as you go through the year, read it as much as possible and while reading actually think about the topics, not just reciting the words. Each time you do this, you will have forgotten certain facts or details, so focus on getting these down for the next time I read the summary.
As for algorithm writing, you need to memorise the standard algorithms' logic, rather than line by line.
Don't intend to burst anyone's bubble. But the textbook itself isn't good enough. It would consist more of 'self-learning, and research'. What you should do is have a read of the syllabus, and look up those specific topics in your textbook, then if you require more information search on the internet. I've purchased many textbooks, and a lot of them cover the core topics, but fail to explain it so we can understand.
I always wanted to learn maths in-depth, but a way I would understand it if the formula was provided with step by step example of how it's used, and calculates the answer. For SDD it's similar.