示例#1
0
        public void BinarySearch(int[] list, int target, int expected)
        {
            // Act
            int actual = ZAlgorithms.BinarySearch(list, i => i, target, new Comparison <int>((a, b) => a.CompareTo(b)));

            // Assert
            Assert.That(actual, Is.EqualTo(expected));
        }
 public ZCommandNode this[string command]
 {
     get
     {
         int rightIndex = ZAlgorithms.BinarySearch(commands, c => c.Key, command, (a, b) => a.CompareTo(b));
         if (rightIndex.Equals(-1))
         {
             return(null);
         }
         return(commands[rightIndex]);
     }
 }