python reversed time complexity