give an algo to find the median of a bst ... no additional info is given
--
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
How to device an algo to convert a number given in words to int?
Eg-
i/p: ninety nine thousand fourth
o/p: 99040
Algorithm should work for all possible inputs.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
How will you find the number of occurrence of maximum value in an
array
u can traverse only 1 time
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group,
given an integer.. assume some range by yourself
give an algo such that if i input 1024 it outputs one thousand twenty four
--
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
Don't try to simulate the scheduler on every second. The total execution
time can reach 5 * 10^9 sec.
Play with small examples, get the task list in execution order, and
find the cyclic property of the list.
You can solve this problem in O(N) time complexity.
On 2010-6-20 18:15, Shravan
Given a byte, write a code to swap every two bits. [Using bit
operators] Eg: Input: 10 01 11 01 Output: 01 10 11 10
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe
Not hard at all:
y = ((x 0xAA) 1) | ((x 0x55) 1)
Dave
On Jun 21, 7:07 am, amit amitjaspal...@gmail.com wrote:
Given a byte, write a code to swap every two bits. [Using bit
operators] Eg: Input: 10 01 11 01 Output: 01 10 11 10
--
You received this message because you are subscribed to
As you traverse the array, every time an element of the array is
greater than the maximum you have found so far, update the max and
save its index.
Dave
On Jun 21, 9:34 am, sharad sharad20073...@gmail.com wrote:
How will you find the number of occurrence of maximum value in an
array
u can
Upon rereading your question, maybe I answered the wrong one. My
previous response was how to find the location of the maximum
occurrence, but maybe you meant the number of occurrences of the
maximum. In that case, as you traverse the array, every time you find
an element greater than the max you
Here is a code for it.
http://codepad.org/P115Iud7
On Mon, Jun 21, 2010 at 9:48 AM, Dave dave_and_da...@juno.com wrote:
Upon rereading your question, maybe I answered the wrong one. My
previous response was how to find the location of the maximum
occurrence, but maybe you meant the number
How will you find all the combination of number whose sum is n
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
oops
so sleek and simple :)
Mohit Ranjan
On Mon, Jun 21, 2010 at 10:11 PM, Dave dave_and_da...@juno.com wrote:
Not hard at all:
y = ((x 0xAA) 1) | ((x 0x55) 1)
Dave
On Jun 21, 7:07 am, amit amitjaspal...@gmail.com wrote:
Given a byte, write a code to swap every two bits. [Using
@Amit
char foo=157;//10 01 11 01
unsigned char temp;
unsigned char base=1;
int i;
for(i=7; i0; i=i-2)
{
temp=foo (basei); // saving the 7th, 5th, 3rd, 1st bit
printf(%x\n, temp);
foo = (~(basei) foo) | (((base(i-1)) foo)1); // moving 6th,
4th, 2nd, 0th bit to adjacnt
traverse the array ...take two variables min and max ... and update them
...while traversing.
finally min will contain the most negative value,,, and max will contain the
most positive vale... do max-min.. that will be S
On Mon, Jun 21, 2010 at 5:38 PM, amit amitjaspal...@gmail.com wrote:
sry ..whatever u have posted ...i hve posted this approach mistakenly in
lexographically next string waale mewaise i think this approach
works
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
@ Dave would u plz bother to discuss how do u arrive at this formula?
On Mon, Jun 21, 2010 at 10:11 PM, Dave dave_and_da...@juno.com wrote:
Not hard at all:
y = ((x 0xAA) 1) | ((x 0x55) 1)
Dave
On Jun 21, 7:07 am, amit amitjaspal...@gmail.com wrote:
Given a byte, write a code to
i think that if you implement the elements of a string in set you can find
its children easily (specially if you map each set to the real strings) in
O( n . max length of a string . d)
where n is the number of strings and d is running time of set.delete()
after making the graph since the maximum
using divide and conquer you can do it in O(nlogn) your recursive function
must return three values the max and min value in this range and the maximum
difference
but this can also be solved in O(n)
start from the end of array if you loop backward you can determine the
max(a[i]) for i=j
and then
On Jun 20, 7:48 am, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote:
give an algo to find a minimum spanning tree of a directed graph ??
--
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD
Kruskal's algorithm:
Remove all the edges in the graph. Re-insert them in
Let me explain, supposing that you haven't really tried to understand
the code. The first logical product picks out bits 1, 3, 5, and 7 and
shifts them 1 position to the right. The second logical product picks
out bits 0, 2, 4, and 6 and shifts them 1 position to the left. Then
just or the two
@jalaj one more constraint is there ij
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
i used this code but its giving me segmentation fault.
vectorintans;//maintains the list of selected objects
for(int x=t-1;x0;x--)//t is the no. of objects
{ if(knap[x][tt]!=knap[x-1][tt])//tt is the capacity of knapack
{
ans.push_back(ar[x].index);
yes i mean diffrent sub binary search tree of Given binary tree
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
23 matches
Mail list logo