0

I've got an API endpoint which looks like this: http://foo.bar/rest-method/{identifier}.
This API returns an object that looks like that:

{
 name: "Example",
 version: "1.0.5.3937"
}

Now I know that the entry with the identifier 2923711253 has got version 1.0.5.3937 while the entry with the identifier 2923823024 has 1.0.6.1334.

I want to find out which identifier is the last one using version 1.0.5.3937 and which is the first one using 1.0.6.1334. I call it 'the breaking point'.

Of course I could write a loop which simply checks all the identifiers which are between the two definied one's, but that seems very inefficient to me.

What algorithm should be used here?

asked Nov 9, 2016 at 9:59

1 Answer 1

3

If it is guaranteed that higher identifier means not lesser version then the fastest way is binary search.

answered Nov 9, 2016 at 10:06
1
  • indeed, git or hg bisect Commented Nov 9, 2016 at 12:30

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.