Last active
February 7, 2017 21:01
-
-
Save jbubriski/16194b94eb3a5ff69ce21e7b2bec8ddc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace SoAlgorithms | |
{ | |
class BinarySearch | |
{ | |
public BinarySearch() | |
{ | |
} | |
public int Search(int[] values, int valueToSearchFor) | |
{ | |
for (int i = 0; i < values.Length; i++) | |
{ | |
} | |
return 1; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace SoAlgorithms | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// var name = "Chiemeka"; | |
var valueToSearchFor = 3; | |
var values = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; | |
var searcher = new BinarySearch(); | |
var index = searcher.Search(values, valueToSearchFor); | |
if (index >= 0) | |
{ | |
Console.WriteLine("Value found at index " + index); | |
} | |
else | |
{ | |
Console.WriteLine("Value not found"); | |
} | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment