A 16 line implementation of the binary search algorithm in C#.
Which I used to create an ASCII table!
For further actions, you may consider blocking this person and/or reporting abuse
A 16 line implementation of the binary search algorithm in C#.
Which I used to create an ASCII table!
For further actions, you may consider blocking this person and/or reporting abuse
Darya Shirokova -
Chinonso Ikewelugo -
Kashif Soofi -
mhossen -
Once suspended, startrekrules will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, startrekrules will be able to comment and publish posts again.
Once unpublished, all posts by startrekrules will become hidden and only accessible to themselves.
If startrekrules is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to C++Love.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag startrekrules:
Unflagging startrekrules will restore default visibility to their posts.
Top comments (3)
Unfortunately this is not a valid binary search algorithm with log(n) complexity. left++ and right— changes search position by one and not by half of remaining items. You need to change left/right to middle+-1.
Fixed..I think
Yes, now it can find any character (from your list) in maximally 8 steps...
You can also enhance code a little... There is no need to use IComparable as a parameter to the Search method. You have generics and thus it would be better to have the parameter of type T. You can specify that "T" is IComparable:
public static int Search<T>(List<T> list, T val) where T : IComparable<T>