MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / GetIdx

Function GetIdx

graph/depthfirstsearch.go:9–16  ·  view source on GitHub ↗
(target int, nodes []int)

Source from the content-addressed store, hash-verified

7package graph
8
9func GetIdx(target int, nodes []int) int {
10 for i := 0; i < len(nodes); i++ {
11 if nodes[i] == target {
12 return i
13 }
14 }
15 return -1
16}
17
18func NotExist(target int, slice []int) bool {
19 for i := 0; i < len(slice); i++ {

Callers 1

DepthFirstSearchHelperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected