Queue Priority Algorithm