panda algorithm