Class JumpSearch
Implements Jump search algorithm for finding a specific value in a sorted list.
Inheritance
System.Object
JumpSearch
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: AlgorithmsAndDataStructures.Algorithms.Search
Assembly: AlgorithmsAndDataStructures.dll
Syntax
public class JumpSearch
Methods
| Improve this Doc View SourceSearch<T>(List<T>, T)
Performs a jumpSearch on a list of integers to find the key
.
Notice that only works if the given list is sorted.
Declaration
[Algorithm(AlgorithmType.Search, "JumpSearch", Assumptions = "List is sorted with an ascending order.")]
[SpaceComplexity("O(1)", false, InPlace = true)]
[TimeComplexity(Case.Best, "O(1)")]
[TimeComplexity(Case.Worst, "o(√n)")]
[TimeComplexity(Case.Average, "O(√n)")]
public static int Search<T>(List<T> sortedList, T key)
where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<T> | sortedList | A sorted list of any comparable type. |
T | key | The value the method is searching for. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the |
Type Parameters
Name | Description |
---|---|
T |