Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsStringLinear ¶
ContainsStringLinear checks if a slice contains a given element using a linear search.
This method has a time complexity of O(n), where n is the length of the slice.
It is suitable for small slices or when the slice is not expected to contain the element.
func ContainsStringMap ¶
ContainsStringMap checks if a slice contains a given element using a map for faster lookups.
This method has a time complexity of O(n) for creating the map, and O(1) for the lookup.
However, it has a space complexity of O(n), where n is the length of the slice.
It is suitable for large slices or when the slice is expected to contain the element.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.