C(n+1,2)^2
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this
I think Ordered array Search time = O(logn) whereas for bucket
complexity=O(sqrt(n)) as it is unordered.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
use unsubscribe link at bottom of mail.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For
(nxn) = 2^((n-1)^2)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options,
We can store their freq. as in run-length encoding, each dig freq. would
require 1/2 byte storage .10 digits would require 5 bytes = 2 integer type
variables or LL int .Digit seq. don't need to be stored coz they appear one
after another beginning from 1.
--
You received this message because you
for(i=sz-2;i=0;i--)
for(j=0;j=i;j++)
ar[i][j]+=min(ar[i+1][j],ar[i+1][j+1]);
coutar[0][0];
is this fine.?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from
#includecmath
#includecstdio
#includeiostream
#includestring
using namespace std;
#define ll long long int
#define INF 0x7fff
int mask(ll x,string str,ll dist)
{
ll re=INF,y=0,len;
len=str.size();
for(int i=0;ilen;i++)
if( !(x(1LLi)) || str[(i+dist)%len]re )continue;
#includecmath
#includecstdio
#includeiostream
#includestring
using namespace std;
#define ll long long int
#define INF 0x7fff
ll mask(ll x,string str,ll dist)
{
ll re=INF,y=0,len;
len=str.size();
for(int i=0;ilen;i++)
if( !(x(1LLi)) || str[(i+dist)%len]re )continue;
#includecmath
#includecstdio
#includeiostream
#includestring
using namespace std;
#define ll long long int
#define INF 0x7fff
ll mask(ll x,string str,ll dist)
{
ll re=INF,y=0,len;
len=str.size();
for(int i=0;ilen;i++)
if( !(x(1LLi)) || str[(i+dist)%len]re
I dint get wat are you speaking of.each alphabet is mapped onto
ascii_val-'a' ie ascii of a=97. now check for odd and even occurence is
performed. Work it on paper u'll get it.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
How much time does he reach home is a bad question to ask.
Say i walk 90-x minutes before i meet my driver.If i had walked x more
minutes the driver would have reached my office. I save the driver's x
minutes which he takes for onwards journey from the point of meet.Eventually
i save 20 min
How much time does he reach home is a bad question to ask.
Say i walk 90-x minutes before i meet my driver.If i had walked x more
minutes the driver would have reached my office. I save the driver's x
minutes which he takes for onwards journey from the point of meet.Eventually
i save 20 min
str[i]-'a' th bit is toggled.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more
Can u specify an Xample.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options,
#includestring
using namespace std;
int main()
{
int x=0;
string str;
cinstr;//only lowercase
for(int i=0;istr.size();i++) x^=(1(str[i]-97));
if(str.size()1)
{ if(!(x(x-1)))coutPalindrome\n;
else coutNot palindrome\n;
}
else
{if(!x)coutPalindrome\n;
else coutNot palindrome\n;
check power of 2.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit
Worst case 99 get released.
Is that correct..?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
I smell something BONe - Y :P
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more
Use 8 mask integers or 4 LL to cover the complete ascii range.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
To get complete 32 bit inverse :
x=((x1)0x) | ((x1)0x);
x=((x2)0x) | ((x2)0x);
x=((x4)0x0F0F0F0F) | ((x4)0xF0F0F0F0);
x=((x8)0x00FF00FF) | ((x8)0xFF00FF00);
x=((x16)0x) | ((x16)0x);
--
You received this
Solution assuming MSB the last digit
x=((x1)0x) | ((x1)0x);
x=((x2)0x) | ((x2)0x);
x=((x4)0x0F0F0F0F) | ((x4)0xF0F0F0F0);
x=((x8)0x00FF00FF) | ((x8)0xFF00FF00);
x=((x16)0x) | ((x16)0x);
Div n Conquer O(nlogn)
Thanks
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For
vectorint v[HMAX];
Fill(ar,0,n-1,0);//main() call
void Fill(int ar[],int start,int end,int idx)
{
if(startend)return;
v[idx].push_back(ar[start]);
Fill(ar,start+1,(end+start)/2,idx+1);
Fill(ar,(end+start)/2+1,end,idx+1);
}
ar[] is input array/
v contains
Use trie for dictionary.Use permutaion to generate all anagrams and check
finally.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
I think equal is referred as congruent.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For
Lishabh nice xplanation bro :)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more
#includeiostream
#includestring
using namespace std;
void permute(string str,int x,string print)
{
int mask=0;
if(!x){coutprintendl;return;}
for(int i=0;ix;i++)
{
if(mask(1(str[i]-'a')))continue;
if(i i+1x)
int generate()
{
x=bit();
y=bit();
if(x^y == 0) return generate();
return x;
}
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
Nishant. Your algorithm works for finding repeated nos. in a [n+2] array
where [1-n] are present atleast once and the same number is not being
repeated twice.
Reanalyze the question.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
@Nishant:
1 4 5 4 5n=5
1 2 3 4 5
after xor i.e. your x1 answer contains (2^3^1^1).The missing elements are
included in xor as well along with repeating elements.
Hope now you got it. You are giving solution for a question which i have
defined in previous post. and your algo will fail when
@Nishant:
1 4 5 4 5n=5
1 2 3 4 5
after xor i.e. your x1 answer contains (2^3^4^5).The missing elements are
included in xor as well along with repeating elements.
Hope now you got it. You are giving solution for a question which i have
defined in previous post. and your algo will
After 22nd plz post ur questions ... !!
It wud be of great HelP.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
Reading the input will cost n^2
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more
nice 1 sunny :)
On Mon, Jul 18, 2011 at 11:16 PM, sunny agrawal sunny816.i...@gmail.comwrote:
oh common thats what have been discussed above :P
On Mon, Jul 18, 2011 at 10:52 PM, sagar pareek sagarpar...@gmail.comwrote:
oh common its a very tricky question
take 6 variables
min0,min1,min2
O(m+n) start at bottomleft corner. If target value is found value move
right , if less move above else uve got the number.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To
#includecstdlib
#includeiostream
using namespace std;
struct node{
int val;
node *next;
};
node * Input(int n)
{
node *temp,*list,*end;
int x;
for(int i=0;in;i++)
{
cinx;
temp=(node*)malloc(sizeof(node));temp-val=x;temp-next=NULL;
A pre-order traversal which is used to index the (min,max) pair value
at each level except the bottom-most level where all the entries are
to be printed. O(n) time O(log n) memory.
On 7/17/11, swetha rahul swetharahu...@gmail.com wrote:
Sagar , Shubam Maheshwari
Use O(2n) memory , list the in-order traversal of BST say A[0..n].
and K-A[0...n] say B . Now apply standard merge function(Merge sort)
on A and B. keeping track of equal found elements during comparison to
get the ans.
On 7/17/11, sagar pareek sagarpar...@gmail.com wrote:
You must take an
O(n!)
On Fri, Jul 15, 2011 at 12:17 PM, Sarvesh kumar.sarv...@gmail.com wrote:
it is simple n*n ways.
On Thu, Jul 14, 2011 at 11:36 PM, tendua 6fae1ce6347...@gmail.com wrote:
We are given n by n boolean matrix ( n = 20). Output of matrix should
be such that every row and every column
You are provided with a bit generator which generates 1 and 0 with equal
probabilities i.e. (1/2). You are required to design a function which
generates numbers form 1-1000 with equal probabilities i.e. (1/1000).
--
You received this message because you are subscribed to the Google Groups
If rand() generates equi-probable numbers within range [1 - n] and n is a
multiple of 1000 then your above code will be correct.
You should utilize the bit-generator function.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
its correct.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this
nos [1001,1023] are neglected as if their probabilities are set to zero and
recalculated.As nos [1,1000] are only considered and as they are generated
with equal probabilities i.e. 1/1024. I feel the above solution to be
correct.
--
You received this message because you are subscribed to the
Will a Back-tracking solution suffice..??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
initially he saw say xy then he saw yx now what next does he
see...containing only x and y??
Please clarify your question..
On Thu, Jul 14, 2011 at 12:59 AM, udit sharma sharmaudit...@gmail.comwrote:
Ans should be 45km/hr. :)
--
Regards
UDIT
DU- MCA
--
You received this
Relation comes out as : y=6x
so x=1 ans y=6.
so 1st: 16 (say km)
2nd: 61
3rd: 106
av. speed=(106-16)/2=45 km/hr
On Thu, Jul 14, 2011 at 1:13 AM, Siddharth kumar
siddhartha.baran...@gmail.com wrote:
1st: xy
2nd: yx
3rd: x0y
--
You received this message because you are subscribed to the
are you saying that x finally contains the number of bits that are set to
1..??
On Tue, Jul 12, 2011 at 1:09 AM, Dave dave_and_da...@juno.com wrote:
@rShetty: Ask a question. What do you need to know?
Dave
On Jul 11, 1:26 pm, rShetty rajeevr...@gmail.com wrote:
Some more Explanation of
...@juno.com wrote:
@SkRiPt: Yes.
Dave
On Jul 11, 2:43 pm, SkRiPt KiDdIe anuragmsi...@gmail.com wrote:
are you saying that x finally contains the number of bits that are set to
1..??
On Tue, Jul 12, 2011 at 1:09 AM, Dave dave_and_da...@juno.com wrote:
@rShetty: Ask a question
Got it :)
On Tue, Jul 12, 2011 at 1:18 AM, Dave dave_and_da...@juno.com wrote:
@SkRiPt: Yes.
Dave
On Jul 11, 2:43 pm, SkRiPt KiDdIe anuragmsi...@gmail.com wrote:
are you saying that x finally contains the number of bits that are set to
1..??
On Tue, Jul 12, 2011 at 1:09 AM
49 matches
Mail list logo