I have a list of tasks and i before running them i sort them by an order field. (order 0 runs first, then order 1, etc). the generating of that list takes some and i want to start executing before the list is finished so could use a flow for it. but sorting would require the list to be complete, so instead i want a flow that first emits all the entries with order = 0, then when the flow is finished i want to sort the rest of the elements and execute those. is there a way to do that with flows?
j
julian
06/03/2021, 2:19 PM
Why not use a min heap?
c
christophsturm
06/03/2021, 4:04 PM
How would that work?
j
julian
06/03/2021, 6:04 PM
it's nothing specific to flows. But a min heap will guarantee that the top of the heap will be an order with the minimum order # so far. And you add orders as they come in.
julian
06/03/2021, 6:04 PM
A min heap is pretty straightforward to implement - lots of examples online - if you choose to go in that direction.