Abhishek S
BAN USERIs resultant array space allocated seperately from the two sorted arrays?
- Abhishek S June 01, 2013Merge sorting uses extra space....
- Abhishek S June 01, 2013This should work fine ...
void filter(char *str)
{
int j = 0;
int remove=0;
if ( !str )
return;
for (j =0 ; str[j] != '\0'; j++)
{
if(str[j] == 'b' )
remove++;
else if ( str[j] == 'a' && str[j+1] == 'c')
{
remove+=2;
j++;
}
else
str[j-remove] = str[j];
}
str[j - remove] = '\0';
}
Great
- Abhishek S May 31, 2013Not working for many strings such as abac, adb, etc.
- Abhishek S May 31, 2013As you are using stack this is not inplace.. Space complexity O(n)
- Abhishek S May 27, 2013Suppose the list is {[-5]->[3]->[-5]} and you want to insert {[-6]} in it. diff = -6-3 = -9. diff < 9999 but diff < 0, so you will insert this after [-5] and before [3] but this should get inserted before [-5] and after [3] .
- Abhishek S September 04, 2012This will not work if the input numbers are negative. This can be solved without the third argument as well.
- Abhishek S September 04, 2012@Anonymous you are right. I think we need to traverse from head comparing the next value with the given node. If the value of next node is greater insert the node before that node. As the list is sorted you will defintely find a place for this node in O(n).
- Abhishek S September 04, 2012Just did some pointer correction, otherwise this is correct.
boolean isCompleteBT(Node* root) {
If (root != null) {
return ((root->left == null && root->right == null) || (root->left != null && root->right != null)) && isCompleteBT(root->left) && isCompleteBT(root->right));
}
return true;
}
Repbilliejeckley, SEO at Flipkart
Spent 2002-2008 testing the market for spit-takes in Los Angeles, CA. Spent 2001-2004 deploying how to get boyfriend back by ...
Repangilafinch, Applications Developer at Aristocrat Gaming
I am Angila, expert system operator in Linens'n from 2017, Where I interact with network providers and perform troubleshooting ...
Repjaynebackus, Applications Developer at Achieve Internet
I am Jayne And I am working as a Record center clerk in a company. Also I'm doing a ...
Merge from backwards... thats it
- Abhishek S June 02, 2013