two

package
v0.0.0-...-a6853de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPermutation

func IsPermutation(s1, s2 string) bool

IsPermutation returns true if strings are permutations of each other. It sorts each rune in the string and then compares them for equality. Since each string is sorted runtime is O(N log N) where N=len(s1)+len(s2)

func IsPermutationDS

func IsPermutationDS(s1, s2 string) bool

IsPermutationDS returns true if strings are permutations of each other. It uses a map of space O(N) to count occurrences of runes in one string. It then removes each rune occurrence that appears in the second string. Runtime is O(N) thanks to the map.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL