Re: [algogeeks] Re: Power(n^n)

2012-06-12 Thread hary rathor
there would no problem of rang if

 K^(1/N)==N

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: MS Question : find word in 2D array

2012-06-12 Thread hary rathor
1 search should in using KMP algo so that It can be seacrh in O(n) . let
function is   int KMP(src,trget, searchDirection )
this kmpSearch funtion should be implemented is such a fashion that is
search in both direction.
3. assume that give 2d array name is array

const int row =1;
const int col =1;
const int dig =1;

for(i=0;iM;i++)   //O(n^2)
{

KMP(array,target, row);  //O(n)

KMP(array,target,col ); //O(n)

KMP(array,target, dig );//O(n)

}

result in O(n^2)

but still looking for better solution

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Can anyone explain this strange behavior ?

2012-06-12 Thread nadeem khan
i=-3  it gets incremented to -2 (++i)
m is evaluated and as ++i is non zero it evaluates to TRUE and m is
assigned value 1,  hence remaining part is not executed , so j and k is not
incremented.

On Tue, Jun 12, 2012 at 2:19 AM, Dave dave_and_da...@juno.com wrote:

 This is the result of short-circuit evaluation. See, e.g.,
 http://en.wikipedia.org/wiki/Short-circuit_evaluation, or this topic in
 your language reference.

 Dave

 On Monday, June 11, 2012 2:28:52 PM UTC-5, ((** VICKY **)) wrote:

 #includestdio.hint main(){int i,j,k,m,l;
 i=-3;
 j=2;
 k=0;m=++i || ++j  ++k ;printf 
 http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(\n%d 
 %d %d %d,i,j,k,m);return 0;}

 o/p: -2 2 0 1


 k should be 1 right


 --
 Cheers,

   Vicky

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/8PoAya7NqjYJ.

 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 group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



RE: [algogeeks] Re: Can anyone explain this strange behavior ?

2012-06-12 Thread Ashot Madatyan
k should be 1 right 
No, it shouldn't be because the expression evaluation will stop at the very
first sub-expression as soon as it evaluates to true in the m=++i || ++j 
++k ; 
And the first sub-expression that evaluates to true is the  ++i 
 
Rgds,
Ashot

 

From: algogeeks@googlegroups.com [mailto:algogeeks@googlegroups.com] On
Behalf Of nadeem khan
Sent: Tuesday, June 12, 2012 6:39 AM
To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] Re: Can anyone explain this strange behavior ?

 

i=-3  it gets incremented to -2 (++i)

m is evaluated and as ++i is non zero it evaluates to TRUE and m is assigned
value 1,  hence remaining part is not executed , so j and k is not
incremented.

 

On Tue, Jun 12, 2012 at 2:19 AM, Dave dave_and_da...@juno.com wrote:

This is the result of short-circuit evaluation. See, e.g.,
http://en.wikipedia.org/wiki/Short-circuit_evaluation, or this topic in your
language reference.

 

Dave


On Monday, June 11, 2012 2:28:52 PM UTC-5, ((** VICKY **)) wrote:

#includestdio.h
int main()
{
int i,j,k,m,l;
i=-3;
j=2;
k=0;
m=++i || ++j  ++k ;
 http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
printf(\n%d %d %d %d,i,j,k,m);
return 0;
}
 
o/p: -2 2 0 1
 
 
 
k should be 1 right 

 

-- 
Cheers,

 

  Vicky

 

-- 
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.

To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/8PoAya7NqjYJ.


To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com
mailto:algogeeks%2bunsubscr...@googlegroups.com .
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.

 

-- 
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 group at
http://groups.google.com/group/algogeeks?hl=en.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Problem(algo+filesystem): Fetch last K -MB data from data stream

2012-06-12 Thread Praveen
Hi,

I need some suggestion in solving one problem.

*Statement:* There is a input stream of characters. This will flow for
infinite time. Now, the task is to store most recent K mb data in a text
file at any time T.
*Constraint*: you can not use buffer of size K mb directly because of
memory constraint although you can use other temp files if it work.

Please revert back if any clarification needed...

Thanks  Regards,
Praveen

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Adobe interiew question

2012-06-12 Thread Anika Jain
how can we implement exception handling in c?

-- 
Regards
Anika Jain

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Adobe interiew question

2012-06-12 Thread Abhishek Goswami
we can handle exception handling through macro.
http://en.wikibooks.org/wiki/C_Programming/Error_handling


On Tue, Jun 12, 2012 at 9:47 PM, Anika Jain anika.jai...@gmail.com wrote:

 how can we implement exception handling in c?

 --
 Regards
 Anika Jain

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Adobe interiew question

2012-06-12 Thread Shashank Narayan
yes u can review that link :)

On Tue, Jun 12, 2012 at 9:47 PM, Anika Jain anika.jai...@gmail.com wrote:

 how can we implement exception handling in c?

 --
 Regards
 Anika Jain

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
*Thanks
Shashank Mani Narayan
Computer Science  Engineering
Birla Institute of Technology,Mesra
** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/;
FB Page http://www.facebook.com/pages/Cracking-The-Code/148241881919895
Google+ http://gplus.to/wgpshashank
Twitter https://twitter.com/wgpshashankhttps://twitter.com/#%21/wgpshashank

Puzzled Guy @ http://ashutosh7s.blogspot.com**
**FB Page http://www.facebook.com/Puzzles.For.Puzzled.Minds*
* Key Person Algogeek https://groups.google.com/forum/#!forum
/algogeekshttps://groups.google.com/forum/#%21forum/algogeeks

**Cell +91-9740852296
*


*
**
*

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] [amazon]: dutch national flag algorithm

2012-06-12 Thread Mad Coder
Let array contains 3 types of elements R,G,B.

Now, if we place all the R elements from the left and B elements from the
right then G elements will automatically be between the two.

Thus we only have to keep indexes for the R and B elements inserted till
now and update their positions accordingly to the current array element we
are accessing.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] spoj problem

2012-06-12 Thread gaurav yadav
plz nyone explain how to approach this problem..
http://www.spoj.pl/problems/XORROUND/

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Permutations of a string

2012-06-12 Thread KK
Thanks Gene :D

On Tuesday, 8 May 2012 07:24:01 UTC+5:30, Gene wrote:

 You just need to make sure that the same character is never swapped to 
 the same position twice.  Here is one way to do it. 

 #include stdio.h 
 #include string.h 

 void swap(char *s, int i, int j) 
 { 
   char t = s[i]; 
   s[i] = s[j]; 
   s[j] = t; 
 } 

 void permute(char *s, int n) 
 { 
   if (s[n]) { 
 int i; 
 unsigned char done[256] = { 0 }; 
 for (i = n; s[i]; i++) { 
   if (!done[s[i]]) { 
 swap(s, n, i); 
 permute(s, n + 1); 
 swap(s, n, i); 
 done[s[i]] = 1; 
   } 
 } 
   } 
   else printf(%s\n, s); 
 } 

 int main(int argc, char *argv[]) 
 { 
   char buf[10 * 1024]; 
   if (argc  1) { 
 strcpy(buf, argv[1]); 
 permute(buf, 0); 
   } 
   return 0; 
 } 

 On May 7, 6:23 am, Sairam ravu...@gmail.com wrote: 
  Thanks for ur clean Code!! But you haven't considered the case of 
 repeating 
  characters in a string

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/PjyaYiTqYxQJ.
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Adobe interiew question

2012-06-12 Thread saurabh singh
tHE first thing that comes in my mind Signals
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Tue, Jun 12, 2012 at 10:26 PM, Shashank Narayan 
shashank7andr...@gmail.com wrote:

 yes u can review that link :)

 On Tue, Jun 12, 2012 at 9:47 PM, Anika Jain anika.jai...@gmail.comwrote:

 how can we implement exception handling in c?

 --
 Regards
 Anika Jain

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *Thanks
 Shashank Mani Narayan
 Computer Science  Engineering
 Birla Institute of Technology,Mesra
 ** Founder Cracking The Code Lab  http://shashank7s.blogspot.com/;
 FB Page http://www.facebook.com/pages/Cracking-The-Code/148241881919895
 Google+ http://gplus.to/wgpshashank
  Twitter 
 https://twitter.com/wgpshashankhttps://twitter.com/#%21/wgpshashank
 
 Puzzled Guy @ http://ashutosh7s.blogspot.com**
 **FB Page http://www.facebook.com/Puzzles.For.Puzzled.Minds*
 * Key Person Algogeek https://groups.google.com/forum/#!forum 
 /algogeekshttps://groups.google.com/forum/#%21forum/algogeeks
 
 **Cell +91-9740852296
 *


 *
 **
 *

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Differentiate the following declarations.

2012-06-12 Thread Mad Coder
*const char* a* is *equivalent* to *char const * a*

A simple method which most people use in coding is that const is written
after the value which needs to be constant.
So,
*char const *a* means a is a pointer that points to a character which is a
constant i.e you can not change the value which a points to, however you
can change values for a i.e different addresses can be applied to a.
and
*char *const a*  means a is a constant pointer to character i.e you can
change the values pointed by a, however you can not change the values i a
i.e once a is assigned an address, a can not be changed.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.