In SharePoint there's a list with lots of items. Every item has an ID, some other columns and a lookup-field 'PredecessorOf' (with the ID) to another item. So for example I have this:

I have a page with a plain HTML button and jQuery behind it. I need to get the items from the list and when all predecessors of an item are finished I need to set the Status of the successor to 'Started'. Getting the items from the list is done by a CAML-query and this works. I already have some jQuery-code to update a listitem which has been tested and works fine too. The only thing I cannot seem to figure out is: how can I check the predecessors and update their successor if they're all finished.
Keep in mind that the image is just a little example for visual understanding. In the list there are hundreds of items and not all items are a predecessor of another item. Also some items are marked as a SuccessorOf another item. So in that case the item should be updated when the status item with ID equal to SuccessorOf is finished.
I was thinking about to "order/group-by" the items and check but I have no idea how to do this in jQuery. Or is this possible through a CAML query?
Thanks in advance!