Skip to content

Instantly share code, notes, and snippets.

@tmosest
Created February 7, 2017 21:37
Show Gist options
  • Save tmosest/485b405a0f993a833dbb160e63d1d716 to your computer and use it in GitHub Desktop.
Save tmosest/485b405a0f993a833dbb160e63d1d716 to your computer and use it in GitHub Desktop.
Linear Space Time
/**
* This time we are create a variable over and over again in a for loop so we see linear space complexity.
*/
public static void printMultiplesOfFive(int n)
{
for(int i = 1; i <= n; i++) {
int multiple = i * 5;
System.out.println(multiple);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment