How to calculate time and space complexity for these algorithms? I referred many sites but its confusing me. please any one explain me.
1.
 for(i=0;i<n;i++)
 {
    for(j=i;j<n;j++)//this for loop is based on previous 'i'
    {
       foo();
    }
 }
2.
while(m<n)
{
    for(i=0;i<n;i++)
    {
         foo();
    }
}
If possible explain me with some more example. Thanks.
 
    