Only use one notebook at a time. Always write down a date first, on every page if your notes spans to another page. Write down your notes sequentially. Had a diagram in the middle of the page? Continue notes at next page unless you are annotating the diagram. It's much easier to find things when there is a single media in linear form. Having mixed notes is fine. Having a linear order is more important. I would write down my shopping list if I am think of that in the middle of figuring out an algorithm, draw a box around my shopping list, and continue with my algorithm notes.