Skip to content

Questions regarding the binary search example #291

Open

Description

@rohanrayan

Hi

Thanks for the book. Its very interesting.

I have one question regarding the binary search example that you have. The way you optimize further (after making it branchless and using prefetching) is to reorder it in an entzynger array. But since this is an O(n) operation anyway on the array, what is the point? We can as well search for the element while constructing the heap structure right? I dont see the need to do this and then do a binary search (albeit efficient) after that.

So to me it looks like you have introduced an additional O(n) operation to make the O(log n) operation faster, which doesnt make sense to me.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions