algorithm finished