Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 383 Bytes

4.md

File metadata and controls

22 lines (14 loc) · 383 Bytes

4

func count(L []int, v, start, end int) int {
  if start > end { return 0 }
  
  mid := (start + end) / 2;
  
	if L[mid] < v { return count(L, v, mid+1, end) }
  if L[mid] > v { return count(L, v, start, mid-1) }
  
	return 1 + count(L, v, mid+1, end) + count(L, v, start, mid-1)
}

Time Complexity

YOUR ANSWER GOES HERE

Space complexity

YOUR ANSWER GOES HERE