Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- }
- else
- {
- Console.WriteLine("{0} is located at {1} in the poll", name, location + 1);
- }
- Console.ReadLine();
- }
- public static int linearUnsorted(string[] arr, string item)
- {
- int location = 0;
- while (location <arr.Length && !String.Equals(item, arr[location], StringComparison.OrdinalIgnoreCase))
- {
- location++;
- }
- if (location == arr.Length)
- {
- location = -1;
- }
- return location;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement