You can't sort records in memory unless you actually have more than one of them in memory.
You can store the records in an array, a list, a binary tree, a skip-list, or ..... but one way another you...