Java Coder
BAN USER
what is dup of a number?
- Java Coder November 26, 2007we cant do an inorder traversal of the tree and chk for the ascending values as a check fo the tree as - If we have many elements in the order of millions, then we would need an equally huge data structure like a stack or a linked list to store the numbers of the inorder traversal.
- Java Coder November 26, 2007void ReverseWords (char str[])
{
int start = 0, end = 0, length;
length = strlen(str);
/* Reverse entire string */ ReverseString(str, start, length - 1);
while (end < length) {
if (str[end] != ' ') { /* Skip non-word characters */
/* Save position of beginning of word */ start = end;
/* Scan to next non-word character */ while (end < length && str[end] != ' ') end++;
/* Back up to end of word */ end--;
/* Reverse word */ ReverseString(str, start, end);
}
end++; /* Advance to next token */
}
return; }
void ReverseString (char str[], int start, int end) { char temp; while (end > start) {
/* Exchange characters */
temp = str [start];
str [start] = str [end] ;
str [end] = temp;
/* Move indices towards middle */ start++; end--;
} return;
}
can we use heapsort? that is inplace sorting and works well for worst case too.
- Java Coder November 23, 2007cant we also do a BFS?
- Java Coder November 23, 2007Another Solution:
#include<stdio.h>
int main()
{
int a[10][10];
int i,j,k=0,row[10],col[10],rowi,coli,m;
for(j=0;j<10;j++){
for(i=0;i<10;i++){
a[j][i]=k;
k++;
}
}
printf("\n");
printf("\nThe array elements are\n");
for(j=0;j<10;j++)
{
for(i=0;i<10;i++){
{
printf("%d ",a[j][i]);
}
}
printf("\n");
}
//now let me add some zeros randomly
a[1][3]=0;
a[2][4]=0;
//checking which row and col are zeros
k=0;
for(i=0;i<10;i++)
for(j=0;j<10;j++)
if(0==a[i][j])
{
row[k]=i;
col[k]=j;
k++;
}
// now make the corresponding rows and cols zero
for(i=0;i<k;i++)
{
rowi=row[i];
for(m=0;m<10;m++)
a[rowi][m]=0;
}
for(j=0;j<k;j++)
{
coli=col[j];
for(m=0;m<10;m++)
a[m][coli]=0;
}
printf("\nThe array elements with row column zeros are\n");
for(j=0;j<10;j++)
{
for(i=0;i<10;i++){
{
printf("%d ",a[i][j]);
}
}
printf("\n");
}
return 0;
}
If the data has some set of numbers that repeat very often, then we can have a hash table for it. for the remaining digits, we can have a BST. This will reduce the height of the BST and hence the value of log(n)
- Java Coder November 23, 2007Raman, are u suggesting to do the following?
look at the curNode
If node1->data and node2->data are less than the curNode->data
go to the the left child
If node1->data and node2->data are greater than the curNode->data
go to the right child
Otherwise
The curNode is the lowest common ancestor
The speed of the minute hand is 6 deg per minute. That of the hour hand is 1/12 as much, that is, 0.5 deg. The smallest angle occurs when
the time is closest to when the two hands meet. The meeting instances are n o'clock 60n/11 minutes, 1<= n<=10. When n=2 or 9, 60n/11 is 1/11 minute away from an integer minute which is the smallest possible. The angle at that time is (6-0.5)ยท1/11=0.5 deg.
RepRutviLopez, abc at A9
I have demonstrated skills in written communication with multiple award winning pieces and a strong willingness to revise and edit ...
Reprafaeltanner210, Associate at 247quickbookshelp
I am Labor relations directors, oversee employment policies in union and nonunion settings. I draw up, negotiate, and administer labor ...
Replorfalinda8, Travel Agent at Creative Wealth
Hello, I am Janice. I help people make travel arrangements, which include booking flights, hotels, sightseeing tours, and making dining ...
RepTimothyAYocum1, Android Engineer at ABC TECH SUPPORT
I am a medical or osteopathic doctor who specializes in eye and vision care. My work Ophthalmologists differ from optometrists ...
Repbrianlwarren596, Android Engineer at 247quickbookshelp
Hey my name is BrainWarren and I am working as an Interpreter.my main work is Interpreters and translators convert ...
RepKayIrish, Animator at ADP
Hey,I am a psychologist.I cure your problems with Vashikaran Specialist In Meerut. I am deeply counseling your problems ...
Repdeborahdond, Rehabilitation counsellor at Parts salesperson
Hello, I am Deborah Rehabilitation counsellors who help people with physical, mental, developmental, or emotional disabilities live independently. I want ...
Repjosebowlin78, Aircraft engineer at CSK Auto
I am an Aircraft engineer . My role as an aircraft engineer involves the application of scientific and technological principles to ...
We can build a hashtable for all the alphabets from the larger file. This shud be done for the 26 alphabets. Now from the smaller file, we take each the charecter one by one and xor it with the hash table after a charecter look up. Now we know taht if the value is present in the hash table, then x^x = 0. So if we get a zero, then we can output that charecter. Any comments?
- Java Coder November 26, 2007