Your brain processes information like a computer. For this it needs time.
Total import of information during the whole day is so big that it cannot process whole of the information simultaneously.
So during night when you are sleeping brain takes up the task of processing information.
Brain does this by storing entire information into different compartments of memory stores.
All superfluous information which we do not need at all is going to be discarded.
Information that is necessary for future is stored
This information shall be retrieved by memory later.
This shows us importance of sleep.
If we do not sleep or have disturbed sleep or the challenging information is such that it needs more time than the whole night of sleep then the brain will not be free enough for the next day’s tasks.
We will behave as if we are busy with our thoughts during the whole day.
Such things happening again and again are the cause of our confusing behavior.
You need enough sleep (6-8 hrs a day) for the proper memory functions.