Sunday, 15 September 2013

Time complexity

Time complexity

Which structure takes more time to execute- No of items in the store are
10,000+
Structure1
if(condition1)
{
executing for 20% of items
if(condition2)
{
executing for 20% of items
if(condition3)
{
executing for 20% of items
}
}
else
{
executing for 20% of items
}
}
else
{
executing for 80% of items
}
Structure2
if(condition2)
{
executing 80% of the items
}
if(condition3)
{
executing 80% of the items
}
if(condition1)
{
executing 20% of items
}
else
{
executing for 80% of items
}

No comments:

Post a Comment