Started working on trees

so like search the array for lowest priority, mark if I found one, keep
going, if reach end of array without another than thats the least
priority and thus the top of the tree?