Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

linear search c#

static int LineSearch(int[] numbers, int num)
        {
            for (int i = 0; i < numbers.Length; i++)
            {
                if (numbers[i] == num)
                {
                    return i;
                }
            }
            return -1;
        }
 
PREVIOUS NEXT
Tagged: #linear #search
ADD COMMENT
Topic
Name
6+5 =