ServiceNow Interview Question

BFS, Sorting in infinite sorted array.