Data structure/ Algorithms


#1

what is space complexity?

#include,stdio.h>
int main()
{
char s[]=“No two viruses work similarly”;
int i=0;
while (s[i]!=0)
{
printf("%c%c\n",s[i],(s+i));
printf("%c%c\n",i[s],
(i+s));
i++;
}
return 0;
}


#2

Space complexity is the extra space that we require.
Here we do not need any extra space , So the space complexity is O(1). i.e constant