Skip to content

Instantly share code, notes, and snippets.

@Tekaichi
Created October 26, 2017 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tekaichi/1ca88a9cf55496bc41755277880fac17 to your computer and use it in GitHub Desktop.
Save Tekaichi/1ca88a9cf55496bc41755277880fac17 to your computer and use it in GitHub Desktop.
Recursive thingy
private static int recSeparate(int[] v, int i, List<Integer> list, int threshold) {
if(i == v.length){
return 0;
}
if(v[i] < threshold){
int a = recSeparate(v,i+1,list,threshold);
list.add(a, v[i]);
return a;
}else{
list.addLast(v[i]);
return recSeparate(v,++i,list,threshold);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment