sweet.prash
BAN USER
- 0of 0 votes
Answerswhy is string immutable?
- sweet.prash in India for BIRD| Report Duplicate | Flag | PURGE
SAS Research Software Engineer / Developer Java - 1of 1 vote
AnswersImplement level search in a binary tree.
- sweet.prash in India for BIRD| Report Duplicate | Flag | PURGE
SAS Research Software Engineer / Developer Algorithm - 0of 0 votes
AnswerLife cycle of servlet
- sweet.prash in India for BIRD| Report Duplicate | Flag | PURGE
SAS Research Software Engineer / Developer Java
hey are we allowed to use some oher data structure like array inside the function
- sweet.prash December 28, 2011Dude..
String Concat(String s1,String s2){
StringBuffer sb = new StringBuffer(s1);
StringBuffer sb1 = new StringBuffer(s2);
sb.concat(sb1);
String s3 = sb.toString();
return s3;
}
Its like this ...
C capacity of each glass... let first glass gets C remainingn N-C it has to be destributed between two class so each gets (N-C)/2
now again the capacity of next glass C so the remagnign for next lavel.. (N-C)/2 -C
so the next level will get (N-3C)/4 so if root is level 0 ie n=1 then each will get (N-(2n-1)*C)/2^n-1
how the complexity is O(n2) in his algo ..
- sweet.prash December 27, 2011I think string buffer is a better solution
- sweet.prash December 27, 2011List add (List l1,List l2){
List l3 =new List();
if(l1 == Null && l2 == Null){
l3=null;
}
while(l1.next != Null && l2.next!= null){
l3.data = l1.data+ l2.data;
l3= l3.next;
}
if(l1.next){
l3.data = l1.data;
l3.next = l1.next;
}
else{
l3.data = l2.data;
l3.next = l2.next;
}
return l3;
}
public void merge(int a[],int []b){
- sweet.prash December 29, 2011while(i<a.length && j<b.length){
if(a[i]=="-1"){
i++;
}
if(b[j] =="-1"){
j++;
}
if(a[i] < b[j]){
i++;
}
else{
swap(a[i],b[j]);
i++;
}
}
}
for(int i=0;i<a.length;i++){
if(a[i] == "-a"){
shiftup(a,i);
}
}
}