Skip to content

Instantly share code, notes, and snippets.

@sojohnnysaid
Last active January 19, 2021 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sojohnnysaid/f982f93809299b928b699cb4ddc2ef32 to your computer and use it in GitHub Desktop.
Save sojohnnysaid/f982f93809299b928b699cb4ddc2ef32 to your computer and use it in GitHub Desktop.
BigO runtime example
#include <stdio.h>
void function(int* numbers);
int main(void)
{
// Big O runtime example
int array[] = {1,2,3,4,5,6,7,8,9,10,42};
// runs in Big O(n);
function(array);
printf("\n");
return 0;
}
void function(int* numbers)
{
for(int i = 0; numbers[i] != 42; i++)
printf("%i ", numbers[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment