[algogeeks] chronus corp..

2011-07-23 Thread sush57
can anyone suggest interview questions for chronus corp...i have
interview on august 1st...

-- 
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] Sorting in O(n)

2011-07-23 Thread rajeev bharshetty
Given a valid range sort keys, the linked list can be sorted in O9n) time
using counting sort which takes O(n+k) comparisons to sort the list of K
elements .

On Sat, Jul 23, 2011 at 9:58 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote:

 10^9--10^9 - 8- 7-  NULL . It wont help in this case...


 On Sat, Jul 23, 2011 at 9:55 AM, keyan karthi 
 keyankarthi1...@gmail.comwrote:

 counting sort ll help to some extent... find the min and max element O(n)
 now u just need an array of size  max-min to store the values then
 just traverse the list and while updating u do value+min... still it is not
 suitable if the magnitude is high.


 On Sat, Jul 23, 2011 at 9:45 AM, Ankur Khurana 
 ankur.kkhur...@gmail.comwrote:

 n logn merge sort.count sort only when range is
 known.


 On Sat, Jul 23, 2011 at 1:35 AM, sunny agrawal 
 sunny816.i...@gmail.comwrote:

 Cannot be done in O(N) if elements of list can take any value because
 then counting sort wont help

 On Sat, Jul 23, 2011 at 1:24 AM, Pankaj jatka.oppimi...@gmail.comwrote:

 For linklist? How


 On Sat, Jul 23, 2011 at 1:23 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 use counting sort..


 On Sat, Jul 23, 2011 at 1:22 AM, rShetty rajeevr...@gmail.comwrote:

 How to sort Linked lists in O(n) time ??
 Give the algorithm or the explanation or clue to tackle the problem

 --
 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.




 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

  --
 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.




 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee

  --
 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.




 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 Delhi.

  --
 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.




 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 Delhi.

  --
 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.




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

-- 
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] Unique characters in a string

2011-07-23 Thread rajeev bharshetty
@Victor : Counting sort uses extra data structures to maintain the count and
the output array , so it is not viable I think ?? what say ??

On Sat, Jul 23, 2011 at 11:04 AM, Victor Manuel Grijalva Altamirano 
kavic1.mar...@gmail.com wrote:

 Use a type of counting sort with ascii


 2011/7/22 SkRiPt KiDdIe anuragmsi...@gmail.com

 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Victor Manuel Grijalva Altamirano
 Universidad Tecnologica de La Mixteca

  --
 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.




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

-- 
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: Coding..........

2011-07-23 Thread rajeev bharshetty
Can we do this as the quick sort does in place , consider an even element as
a pivot then keep two pointers ,one in beginning and other at the end and
then check for even numbers if even increment i and stop on reaching an odd
number now the same way with j pointer a t the end in j until even number is
encountered now swap i and j and recursively do this till you get all even
elements on left and odd elements on right .. What you say?? Does this logic
works ??

2011/7/23 яαωαт Jee anuragrawat1...@gmail.com

 @ popli:  plz change ur email id..placement session will start soon.

 On Jul 22, 8:32 pm, Gaurav Popli abeygau...@gmail.com wrote:
  an O(n) soln
  traveres the array...as you receive odd number put that index in
  queuewhen received an even numb check if queue is empty or
  not...if queue is empty the do nothing else swap with the head of the
  queue
 
  hope it worksit also maintains the stability of aarray...
 
 
 
 
 
 
 
  On Fri, Jul 22, 2011 at 6:39 PM, Kunal Patil kp101...@gmail.com wrote:
   @Sunny: Excellent explanation ( 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.

 --
 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.




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

-- 
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] MS

2011-07-23 Thread Akshata Sharma
Given a string *Str of ASCII characters, write the pseudo code to remove the
duplicate elements present in them. For example, if the given string is
Potato, then, the output has to be Pota. Additional constraint is, the
algorithm has to be in-place( no extra data structures allowed) . Extend
your algorithm to remove duplicates in the string which consisted of UNICODE
characters.

-- 
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] chronus corp..

2011-07-23 Thread sukhmeet singh
Whats the CTC ???

On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com wrote:

 can anyone suggest interview questions for chronus corp...i have
 interview on august 1st...

 --
 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] Re: doubt in evaluating in expression

2011-07-23 Thread Interstellar Overdrive
The expression y = x++ + x++ + ++y;  is not a valid one. The result is 
compiler dependent 
Read this for reference :http://c-faq.com/expr/seqpoints.html






-- 
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/-/-DWyCxlftwgJ.
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] Coding..........

2011-07-23 Thread Interstellar Overdrive
Your algo does not maintain the stability

-- 
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/-/wPJiswbpjk8J.
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: MS

2011-07-23 Thread Akshata Sharma
better than O(n^2)..

On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 Given a string *Str of ASCII characters, write the pseudo code to remove
 the duplicate elements present in them. For example, if the given string is
 Potato, then, the output has to be Pota. Additional constraint is, the
 algorithm has to be in-place( no extra data structures allowed) . Extend
 your algorithm to remove duplicates in the string which consisted of UNICODE
 characters.



-- 
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] Coding..........

2011-07-23 Thread Interstellar Overdrive
@Narain : There algorithm does not maintain the stability..
 Test for: {2,4,3,1,5,6} 
 output: {2,4,6,1,5,3}





Abhishek Khattri

-- 
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/-/awUZhDyryT4J.
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] Coding..........

2011-07-23 Thread Anurag Narain
@khattri:thanks :) i thought it was 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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Coding..........

2011-07-23 Thread sravanreddy001
@rShetty.. ture.. the pivot element iteration doesn't maintain stability..

O(n) with O(n) seems to be better approach. -- pushing all elements into a 
two linked lists.. and joining them in the end.

-- 
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/-/5UjlYoLjVaQJ.
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] stacks

2011-07-23 Thread Kamakshii Aggarwal
consider a language that does no have arrays...but u can define stack data
type like
stack s;
using pop ,push and other operations on  2 stacks,how can one dimensions
array can be implemented??


-- 
Regards,
Kamakshi
kamakshi...@gmail.com

-- 
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: doubt in evaluating in expression

2011-07-23 Thread sagar pareek
@Venga
if u are doing this
y= x++ + ++x; //x=3
then it would be
like that :-
++x; //x=4
y=x+x;
x++;

i thing this is sufficient  :)

On Sat, Jul 23, 2011 at 1:20 PM, Interstellar Overdrive 
abhi123khat...@gmail.com wrote:

 The expression y = x++ + x++ + ++y;  is not a valid one. The result is
 compiler dependent
 Read this for reference :http://c-faq.com/expr/seqpoints.html






  --
 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/-/-DWyCxlftwgJ.

 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.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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: doubt in evaluating in expression

2011-07-23 Thread shady
@sagar
would it get evaluated like this ?
supposing x = 3;

y = x++ + ++x; becomes y = (x=x+1) + (x=x+1);
then x=x+1;

so x = 5, y = 8;

On Sat, Jul 23, 2011 at 2:48 PM, sagar pareek sagarpar...@gmail.com wrote:

 @Venga
 if u are doing this
 y= x++ + ++x; //x=3
 then it would be
 like that :-
 ++x; //x=4
 y=x+x;
 x++;

 i thing this is sufficient  :)

 On Sat, Jul 23, 2011 at 1:20 PM, Interstellar Overdrive 
 abhi123khat...@gmail.com wrote:

 The expression y = x++ + x++ + ++y;  is not a valid one. The result is
 compiler dependent
 Read this for reference :http://c-faq.com/expr/seqpoints.html






  --
 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/-/-DWyCxlftwgJ.

 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.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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] Re: MICROSOFT!!!!

2011-07-23 Thread prasanth


the CFG was actually
s-AB
A- a| BaB
B-bbA

The false statement i guess was This grammar doesnt produce a string
of 4 consecutive bs


and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
rightmost set bit


pointer related questions were asked.One such was

(1)int arr[2][3]={{1,2,3},{4,5,6}};
int (*ptr)[3]=a[0];
printf((%d,%d),(*ptr)[1],(*ptr)[2]);
ptr+=1;
printf((%d,%d),(*ptr)[1],(*ptr)[2]);

find the output???

(2) double full(double a)
{
return (int)(a+0.5);
}

does this always work??

(3) int x=123,y=231;
int t=0;
int l;
l=x^y;
while(l)
{
t++;
l=l-1;
}
printf(%d,t);

-- 
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] Unique characters in a string

2011-07-23 Thread keyan karthi
yup tat should work fine :) :)

On Sat, Jul 23, 2011 at 10:03 AM, rajeev bharshetty rajeevr...@gmail.comwrote:

 Use Quick sort to sort the characters of a string (qsort is inplace sorting
 ) then check for consecutive characters in the array,  if they are same then
 the string is not unique else unique .(use builtin qsort in C .) No
 additional data structure is used ... What do u think of this guys ??

 On Sat, Jul 23, 2011 at 9:52 AM, Reynald reynaldsus...@gmail.com wrote:

 Implement an algorithm to determine if a string has all unique
 characters. What if you can not use additional data structures?

 --
 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.




 --
 Regards
 Rajeev N B http://www.opensourcemania.co.cc


  --
 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] Unique characters in a string

2011-07-23 Thread Reynald Suz
This code works perfectly. Try out with different test data.
int main()
{
//char str[]=qwertyuioplkjhgfdsazxcvbnm;
char str2[] = qwertyquejolpd;
int val, i;
int len = strlen(str);
int unique=1;
int checker=0;
for(=0;ilen;i++)
{
   val = str[i]-'a';
  if( (checker  (1val))  0 )
  {
 printf(\nNo, there aren't unique.);
 unique=0;
 break;
  }
   checker |= (1val);
}
if(unique==1)
 printf(\nUnique charaters.);
return 1;
}


On Sat, Jul 23, 2011 at 12:18 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 @Victor : Counting sort uses extra data structures to maintain the count
 and the output array , so it is not viable I think ?? what say ??


 On Sat, Jul 23, 2011 at 11:04 AM, Victor Manuel Grijalva Altamirano 
 kavic1.mar...@gmail.com wrote:

 Use a type of counting sort with ascii


 2011/7/22 SkRiPt KiDdIe anuragmsi...@gmail.com

 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Victor Manuel Grijalva Altamirano
 Universidad Tecnologica de La Mixteca

  --
 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.




 --
 Regards
 Rajeev N B http://www.opensourcemania.co.cc


  --
 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.




-- 
Regards
Reynald Reni
Masters in Software Engineering
CIT - India

-- 
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] xplain output

2011-07-23 Thread Ankur Khurana
yes, try changing %f to %d somewhere, answers will come right , but can
anyone epalin the reason that if garbage values were to be printed , i am
having same garbage values on my machine as on his :P. How is that answers
and output comes out to be same

On Sat, Jul 23, 2011 at 12:56 AM, rajeev bharshetty rajeevr...@gmail.comwrote:

 I think when the mismatch of the format specifier and the variable occurs ,
 the compiler generates random  number output as, some garbage I suppose .


 On Sat, Jul 23, 2011 at 12:30 AM, geek forgeek geekhori...@gmail.comwrote:

 #includestdio.h
 void main()
 {
 int x;
 float t;
 scanf(%f,t);
 printf(%f\n,t);
 x=90;
 printf(%f\n,x);
 {
 x=1;
 printf(%f\n,x);
 {
 x=30;
 printf(%f\n,x);
 }
 printf(%f\n,x);
 }
 x==9;
 printf(%f\n,x);
 }

 input
 1.1

 output
 1.10
 1.09
 1.09
 1.09
 1.09
 1.09

 --
 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.




 --
 Regards
 Rajeev N B http://www.opensourcemania.co.cc


  --
 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.




-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

-- 
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

2011-07-23 Thread Akash Mukherjee
already discussed many timestry using bitmasks

On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma
akshatasharm...@gmail.com wrote:
 better than O(n^2)..

 On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma akshatasharm...@gmail.com
 wrote:

 Given a string *Str of ASCII characters, write the pseudo code to remove
 the duplicate elements present in them. For example, if the given string is
 Potato, then, the output has to be Pota. Additional constraint is, the
 algorithm has to be in-place( no extra data structures allowed) . Extend
 your algorithm to remove duplicates in the string which consisted of UNICODE
 characters.


 --
 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: MS

2011-07-23 Thread pacific :-)
heapsort ?

On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 better than O(n^2)..


 On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma akshatasharm...@gmail.com
  wrote:

 Given a string *Str of ASCII characters, write the pseudo code to remove
 the duplicate elements present in them. For example, if the given string is
 Potato, then, the output has to be Pota. Additional constraint is, the
 algorithm has to be in-place( no extra data structures allowed) . Extend
 your algorithm to remove duplicates in the string which consisted of UNICODE
 characters.



  --
 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.




-- 
regards,
chinna.

-- 
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: chronus corp..

2011-07-23 Thread sush57
9...

On Jul 23, 12:42 pm, sukhmeet singh sukhmeet2...@gmail.com wrote:
 Whats the CTC ???

 On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com wrote:
  can anyone suggest interview questions for chronus corp...i have
  interview on august 1st...

  --
  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: chronus corp..

2011-07-23 Thread Ankur Garg
9 for how much exp ??


On Sat, Jul 23, 2011 at 3:26 PM, sush57 sushaant...@gmail.com wrote:

 9...

 On Jul 23, 12:42 pm, sukhmeet singh sukhmeet2...@gmail.com wrote:
  Whats the CTC ???
 
  On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com wrote:
   can anyone suggest interview questions for chronus corp...i have
   interview on august 1st...
 
   --
   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.



-- 
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: chronus corp..

2011-07-23 Thread sush57
fresher

On Jul 23, 3:02 pm, Ankur Garg ankurga...@gmail.com wrote:
 9 for how much exp ??

 On Sat, Jul 23, 2011 at 3:26 PM, sush57 sushaant...@gmail.com wrote:
  9...

  On Jul 23, 12:42 pm, sukhmeet singh sukhmeet2...@gmail.com wrote:
   Whats the CTC ???

   On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com wrote:
can anyone suggest interview questions for chronus corp...i have
interview on august 1st...

--
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.

-- 
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: chronus corp..

2011-07-23 Thread Ankur Garg
kool man ...Whr to apply for exp people ??

Can you share some link and all

is company Chronos?



On Sat, Jul 23, 2011 at 3:33 PM, sush57 sushaant...@gmail.com wrote:

 fresher

 On Jul 23, 3:02 pm, Ankur Garg ankurga...@gmail.com wrote:
  9 for how much exp ??
 
  On Sat, Jul 23, 2011 at 3:26 PM, sush57 sushaant...@gmail.com wrote:
   9...
 
   On Jul 23, 12:42 pm, sukhmeet singh sukhmeet2...@gmail.com wrote:
Whats the CTC ???
 
On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com
 wrote:
 can anyone suggest interview questions for chronus corp...i have
 interview on august 1st...
 
 --
 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.

 --
 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] Re: stacks

2011-07-23 Thread ross
Well. the idea of an array is - given an integer 'i', you should
support RANDOM ACCESS to the ith element in the 1d array.
Since, we have two stacks, if you want to access an ith element ( say,
i = 5 ),pop all the top 4 elements from the 1st stack and push it to
the second stack.
Now, access the 5th element on top of the 1st stack, then, pop the
elements from the 2nd stack back and push them to the 1st stack.
However, access is O(n) due to the inherent property of a stack which
forbids random access!


On Jul 23, 2:00 pm, Kamakshii Aggarwal kamakshi...@gmail.com wrote:
 consider a language that does no have arrays...but u can define stack data
 type like
 stack s;
 using pop ,push and other operations on  2 stacks,how can one dimensions
 array can be implemented??

 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

-- 
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: chronus corp..

2011-07-23 Thread Ankur Garg
http://chronus.com/

Is this the site of the company ?


On Sat, Jul 23, 2011 at 3:45 PM, Ankur Garg ankurga...@gmail.com wrote:

 kool man ...Whr to apply for exp people ??

 Can you share some link and all

 is company Chronos?




 On Sat, Jul 23, 2011 at 3:33 PM, sush57 sushaant...@gmail.com wrote:

 fresher

 On Jul 23, 3:02 pm, Ankur Garg ankurga...@gmail.com wrote:
  9 for how much exp ??
 
  On Sat, Jul 23, 2011 at 3:26 PM, sush57 sushaant...@gmail.com wrote:
   9...
 
   On Jul 23, 12:42 pm, sukhmeet singh sukhmeet2...@gmail.com wrote:
Whats the CTC ???
 
On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com
 wrote:
 can anyone suggest interview questions for chronus corp...i have
 interview on august 1st...
 
 --
 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.

 --
 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] Re: chronus corp..

2011-07-23 Thread sush57
yes..

On Jul 23, 3:24 pm, Ankur Garg ankurga...@gmail.com wrote:
 http://chronus.com/

 Is this the site of the company ?

 On Sat, Jul 23, 2011 at 3:45 PM, Ankur Garg ankurga...@gmail.com wrote:
  kool man ...Whr to apply for exp people ??

  Can you share some link and all

  is company Chronos?

  On Sat, Jul 23, 2011 at 3:33 PM, sush57 sushaant...@gmail.com wrote:

  fresher

  On Jul 23, 3:02 pm, Ankur Garg ankurga...@gmail.com wrote:
   9 for how much exp ??

   On Sat, Jul 23, 2011 at 3:26 PM, sush57 sushaant...@gmail.com wrote:
9...

On Jul 23, 12:42 pm, sukhmeet singh sukhmeet2...@gmail.com wrote:
 Whats the CTC ???

 On Sat, Jul 23, 2011 at 11:36 AM, sush57 sushaant...@gmail.com
  wrote:
  can anyone suggest interview questions for chronus corp...i have
  interview on august 1st...

  --
  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.

  --
  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: stacks

2011-07-23 Thread Nikhil Gupta
Nice question Kamakshi. The person above has given almost a perfect answer.

For example i=3, we will pop the elements one by one from the top of the 1st
stack and pushed to the 2nd stack until the value (top - i) is reached.

On Sat, Jul 23, 2011 at 3:52 PM, ross jagadish1...@gmail.com wrote:

 Well. the idea of an array is - given an integer 'i', you should
 support RANDOM ACCESS to the ith element in the 1d array.
 Since, we have two stacks, if you want to access an ith element ( say,
 i = 5 ),pop all the top 4 elements from the 1st stack and push it to
 the second stack.
 Now, access the 5th element on top of the 1st stack, then, pop the
 elements from the 2nd stack back and push them to the 1st stack.
 However, access is O(n) due to the inherent property of a stack which
 forbids random access!


 On Jul 23, 2:00 pm, Kamakshii Aggarwal kamakshi...@gmail.com wrote:
  consider a language that does no have arrays...but u can define stack
 data
  type like
  stack s;
  using pop ,push and other operations on  2 stacks,how can one dimensions
  array can be implemented??
 
  --
  Regards,
  Kamakshi
  kamakshi...@gmail.com

 --
 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.




-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
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

2011-07-23 Thread Akshata Sharma
@akash, the questions says no addition DS should be used. Its  asks for
inplace algorithm.
@chinna, can you explain how heapsort will do it?

On Sat, Jul 23, 2011 at 3:17 PM, pacific :-) pacific4...@gmail.com wrote:

 heapsort ?

 On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma akshatasharm...@gmail.com
  wrote:

 better than O(n^2)..


 On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma 
 akshatasharm...@gmail.com wrote:

 Given a string *Str of ASCII characters, write the pseudo code to remove
 the duplicate elements present in them. For example, if the given string is
 Potato, then, the output has to be Pota. Additional constraint is, the
 algorithm has to be in-place( no extra data structures allowed) . Extend
 your algorithm to remove duplicates in the string which consisted of UNICODE
 characters.



  --
 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.




 --
 regards,
 chinna.

  --
 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: MS

2011-07-23 Thread rajeev bharshetty
How about using quicksort and then comparing adjacent elements (characters)
and then finding the uniqueness 

On Sat, Jul 23, 2011 at 4:38 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 @akash, the questions says no addition DS should be used. Its  asks for
 inplace algorithm.
 @chinna, can you explain how heapsort will do it?


 On Sat, Jul 23, 2011 at 3:17 PM, pacific :-) pacific4...@gmail.comwrote:

 heapsort ?

 On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma 
 akshatasharm...@gmail.com wrote:

 better than O(n^2)..


 On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma 
 akshatasharm...@gmail.com wrote:

 Given a string *Str of ASCII characters, write the pseudo code to remove
 the duplicate elements present in them. For example, if the given string is
 Potato, then, the output has to be Pota. Additional constraint is, the
 algorithm has to be in-place( no extra data structures allowed) . Extend
 your algorithm to remove duplicates in the string which consisted of 
 UNICODE
 characters.



  --
 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.




 --
 regards,
 chinna.

  --
 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.




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

-- 
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

2011-07-23 Thread rajeev bharshetty
How about using quicksort and then comparing adjacent elements (characters)
and then finding the uniqueness and deleting repeated characters ?

On Sat, Jul 23, 2011 at 4:38 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 @akash, the questions says no addition DS should be used. Its  asks for
 inplace algorithm.
 @chinna, can you explain how heapsort will do it?


 On Sat, Jul 23, 2011 at 3:17 PM, pacific :-) pacific4...@gmail.comwrote:

 heapsort ?

 On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma 
 akshatasharm...@gmail.com wrote:

 better than O(n^2)..


 On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma 
 akshatasharm...@gmail.com wrote:

 Given a string *Str of ASCII characters, write the pseudo code to remove
 the duplicate elements present in them. For example, if the given string is
 Potato, then, the output has to be Pota. Additional constraint is, the
 algorithm has to be in-place( no extra data structures allowed) . Extend
 your algorithm to remove duplicates in the string which consisted of 
 UNICODE
 characters.



  --
 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.




 --
 regards,
 chinna.

  --
 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.




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

-- 
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

2011-07-23 Thread KK
www.spoj.pl/problems/SHOP
Its a pretty easy Q... But m not able to figure out any silly mistake
in my prog.. plzz help

#includeiostream
#includevector
#includemap
#includequeue

using namespace std;

char a[26][26];
int si, sj, di, dj, rows, cols;

void BFS(vector vectorint  v, int si, int sj, int rows, int
cols);
int safe(vector vectorint  v, int r, int c, int current, int
rows, int cols);

int main()
{
freopen(input.txt, r, stdin);
freopen(output.txt, w, stdout);

int si, sj;
while(1)
{
 cin  cols  rows;

 if(rows == 0  cols == 0)
  break;

 vectorint row(26, INT_MAX);
 vector vectorint  final(26, row);

 for(int i=0; irows; i++)
   for(int j=0; jcols; j++)
   {
  cin  a[i][j];
  if(a[i][j] == 'S')
  {
 si = i; sj = j;
  }
  else if(a[i][j] == 'D')
  {
 di = i; dj = j;
 a[i][j] = '0';
  }
   }

 BFS(final, si, sj, rows, cols);
 cout  final[di][dj]  endl;

 /*
 for(int i=0; irows; i++)
 {
   for(int j=0; jcols; j++)
  cout  final[i][j]   ;
   cout  endl;
 }
 cout  endl;
 */
}
return 0;
}

void BFS(vector vectorint  v, int si, int sj, int rows, int cols)
{
 pairint, int p;
 queue pairint, int  q;

 q.push(make_pair(si, sj));
 v[si][sj] = 0;

 while(!q.empty())
 {
  p = q.front();   q.pop();
  int current = v[p.first][p.second];

  if(safe(v, p.first+1, p.second, current, rows, cols))
   q.push(make_pair(p.first+1, p.second));

  if(safe(v, p.first-1, p.second, current, rows, cols))
   q.push(make_pair(p.first-1, p.second));

  if(safe(v, p.first, p.second+1, current, rows, cols))
   q.push(make_pair(p.first, p.second+1));

  if(safe(v, p.first, p.second-1, current, rows, cols))
   q.push(make_pair(p.first, p.second-1));

 }
}

int safe(vector vectorint  v, int r, int c, int current, int
rows, int cols)
{
if(r = 0  r  rows  c = 0  c  cols  a[r][c] != 'X')
{
 if(v[r][c]  current + a[r][c] - '0')
 {
 v[r][c] = current + a[r][c] - '0';
 return 1;
 }

}
return 0;
}

-- 
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

2011-07-23 Thread Naveen Kumar
how will be able to arrange the words back?

On Sat, Jul 23, 2011 at 4:50 PM, rajeev bharshetty rajeevr...@gmail.com wrote:
 How about using quicksort and then comparing adjacent elements (characters)
 and then finding the uniqueness and deleting repeated characters ?
 On Sat, Jul 23, 2011 at 4:38 PM, Akshata Sharma akshatasharm...@gmail.com
 wrote:

 @akash, the questions says no addition DS should be used. Its  asks for
 inplace algorithm.
 @chinna, can you explain how heapsort will do it?

 On Sat, Jul 23, 2011 at 3:17 PM, pacific :-) pacific4...@gmail.com
 wrote:

 heapsort ?

 On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma
 akshatasharm...@gmail.com wrote:

 better than O(n^2)..

 On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma
 akshatasharm...@gmail.com wrote:

 Given a string *Str of ASCII characters, write the pseudo code to
 remove the duplicate elements present in them. For example, if the given
 string is Potato, then, the output has to be Pota. Additional 
 constraint
 is, the algorithm has to be in-place( no extra data structures allowed) .
 Extend your algorithm to remove duplicates in the string which consisted 
 of
 UNICODE characters.


 --
 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.



 --
 regards,
 chinna.

 --
 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.



 --
 Regards
 Rajeev N B

 --
 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.




-- 
Cheers
Naveen Kumar

-- 
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] SPOJ

2011-07-23 Thread shady
there's something called spoj forum, try posting it there
secondly, ask whether ur algo is right or wrong, not the code

On Sat, Jul 23, 2011 at 4:51 PM, KK kunalkapadi...@gmail.com wrote:

 www.spoj.pl/problems/SHOP
 Its a pretty easy Q... But m not able to figure out any silly mistake
 in my prog.. plzz help

 #includeiostream
 #includevector
 #includemap
 #includequeue

 using namespace std;

 char a[26][26];
 int si, sj, di, dj, rows, cols;

 void BFS(vector vectorint  v, int si, int sj, int rows, int
 cols);
 int safe(vector vectorint  v, int r, int c, int current, int
 rows, int cols);

 int main()
 {
freopen(input.txt, r, stdin);
freopen(output.txt, w, stdout);

int si, sj;
while(1)
{
 cin  cols  rows;

 if(rows == 0  cols == 0)
  break;

 vectorint row(26, INT_MAX);
 vector vectorint  final(26, row);

 for(int i=0; irows; i++)
   for(int j=0; jcols; j++)
   {
  cin  a[i][j];
  if(a[i][j] == 'S')
  {
 si = i; sj = j;
  }
  else if(a[i][j] == 'D')
  {
 di = i; dj = j;
 a[i][j] = '0';
  }
   }

 BFS(final, si, sj, rows, cols);
 cout  final[di][dj]  endl;

 /*
 for(int i=0; irows; i++)
 {
   for(int j=0; jcols; j++)
  cout  final[i][j]   ;
   cout  endl;
 }
 cout  endl;
 */
}
return 0;
 }

 void BFS(vector vectorint  v, int si, int sj, int rows, int cols)
 {
 pairint, int p;
 queue pairint, int  q;

 q.push(make_pair(si, sj));
 v[si][sj] = 0;

 while(!q.empty())
 {
  p = q.front();   q.pop();
  int current = v[p.first][p.second];

  if(safe(v, p.first+1, p.second, current, rows, cols))
   q.push(make_pair(p.first+1, p.second));

  if(safe(v, p.first-1, p.second, current, rows, cols))
   q.push(make_pair(p.first-1, p.second));

  if(safe(v, p.first, p.second+1, current, rows, cols))
   q.push(make_pair(p.first, p.second+1));

  if(safe(v, p.first, p.second-1, current, rows, cols))
   q.push(make_pair(p.first, p.second-1));

 }
 }

 int safe(vector vectorint  v, int r, int c, int current, int
 rows, int cols)
 {
if(r = 0  r  rows  c = 0  c  cols  a[r][c] != 'X')
{
 if(v[r][c]  current + a[r][c] - '0')
 {
 v[r][c] = current + a[r][c] - '0';
 return 1;
 }

}
return 0;
 }

 --
 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: MICROSOFT!!!!

2011-07-23 Thread Akshata Sharma
What about (2)?, will it always work?

On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.com wrote:



 the CFG was actually
 s-AB
 A- a| BaB
 B-bbA

 The false statement i guess was This grammar doesnt produce a string
 of 4 consecutive bs


 and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
 rightmost set bit


 pointer related questions were asked.One such was

 (1)int arr[2][3]={{1,2,3},{4,5,6}};
 int (*ptr)[3]=a[0];
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 ptr+=1;
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);

 find the output???

 (2) double full(double a)
 {
return (int)(a+0.5);
 }

 does this always work??

 (3) int x=123,y=231;
int t=0;
int l;
l=x^y;
while(l)
{
t++;
l=l-1;
}
printf(%d,t);

 --
 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: MS

2011-07-23 Thread Akshata Sharma
@rajeev, we dont want to change the order of the characters. We just need to
remove the duplicates. Order must be maintained..

On Sat, Jul 23, 2011 at 4:52 PM, Naveen Kumar naveenkumarve...@gmail.comwrote:

 how will be able to arrange the words back?

 On Sat, Jul 23, 2011 at 4:50 PM, rajeev bharshetty rajeevr...@gmail.com
 wrote:
  How about using quicksort and then comparing adjacent elements
 (characters)
  and then finding the uniqueness and deleting repeated characters ?
  On Sat, Jul 23, 2011 at 4:38 PM, Akshata Sharma 
 akshatasharm...@gmail.com
  wrote:
 
  @akash, the questions says no addition DS should be used. Its  asks for
  inplace algorithm.
  @chinna, can you explain how heapsort will do it?
 
  On Sat, Jul 23, 2011 at 3:17 PM, pacific :-) pacific4...@gmail.com
  wrote:
 
  heapsort ?
 
  On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma
  akshatasharm...@gmail.com wrote:
 
  better than O(n^2)..
 
  On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma
  akshatasharm...@gmail.com wrote:
 
  Given a string *Str of ASCII characters, write the pseudo code to
  remove the duplicate elements present in them. For example, if the
 given
  string is Potato, then, the output has to be Pota. Additional
 constraint
  is, the algorithm has to be in-place( no extra data structures
 allowed) .
  Extend your algorithm to remove duplicates in the string which
 consisted of
  UNICODE characters.
 
 
  --
  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.
 
 
 
  --
  regards,
  chinna.
 
  --
  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.
 
 
 
  --
  Regards
  Rajeev N B
 
  --
  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.
 



 --
 Cheers
 Naveen Kumar

 --
 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] Re: MS

2011-07-23 Thread ross
@akshata sharma:
Kindly post a new question as a separate thread and not as a reply to
an existing one so tat it would be noticed by many ppl!
As akash suggestd, use a bit vector called 'visited' of 26 size for
ASCII or of a larger size in case of Unicode ( still constant space
and i dont think declaring 26 variables counts as an additional DS!!),
if visited then , ignore the character while processing.
a simple algorithm,
int last_ptr=0;
for ( i = 0 - N )
{
if(visited(a[i])) continue;
else a[last_ptr++]=a[i];
visited(a[i]) = true;
}
a[last_ptr]=NULL;
print (%s,a) ;



On Jul 23, 12:56 pm, Akshata Sharma akshatasharm...@gmail.com wrote:
 better than O(n^2)..

 On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma
 akshatasharm...@gmail.comwrote:







  Given a string *Str of ASCII characters, write the pseudo code to remove
  the duplicate elements present in them. For example, if the given string is
  Potato, then, the output has to be Pota. Additional constraint is, the
  algorithm has to be in-place( no extra data structures allowed) . Extend
  your algorithm to remove duplicates in the string which consisted of UNICODE
  characters.

-- 
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: MICROSOFT!!!!

2011-07-23 Thread dilip makwana
@Akshata Sharma

(2) double full(double a)
{
   return (int)(a+0.5);
}

I tried this on DevC++ , with various inputs ; it is working fine 

On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com wrote:

 What about (2)?, will it always work?


 On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.comwrote:



 the CFG was actually
 s-AB
 A- a| BaB
 B-bbA

 The false statement i guess was This grammar doesnt produce a string
 of 4 consecutive bs


 and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
 rightmost set bit


 pointer related questions were asked.One such was

 (1)int arr[2][3]={{1,2,3},{4,5,6}};
 int (*ptr)[3]=a[0];
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 ptr+=1;
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);

 find the output???

 (2) double full(double a)
 {
return (int)(a+0.5);
 }

 does this always work??

 (3) int x=123,y=231;
int t=0;
int l;
l=x^y;
while(l)
{
t++;
l=l-1;
}
printf(%d,t);

 --
 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.




-- 
*Dilip Makwana*
VJTI
BTech Computers Engineering
2009-2013

-- 
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

2011-07-23 Thread Akshata Sharma
@ross, I have posted my question in a new thread, not as a reply to any
existing thread!!!

On Sat, Jul 23, 2011 at 5:13 PM, ross jagadish1...@gmail.com wrote:

 check for visited can also be implemented by using an integer variable
 and setting corresponding bits!

 On Jul 23, 4:39 pm, ross jagadish1...@gmail.com wrote:
  @akshata sharma:
  Kindly post a new question as a separate thread and not as a reply to
  an existing one so tat it would be noticed by many ppl!
  As akash suggestd, use a bit vector called 'visited' of 26 size for
  ASCII or of a larger size in case of Unicode ( still constant space
  and i dont think declaring 26 variables counts as an additional DS!!),
  if visited then , ignore the character while processing.
  a simple algorithm,
  int last_ptr=0;
  for ( i = 0 - N )
  {
  if(visited(a[i])) continue;
  else a[last_ptr++]=a[i];
  visited(a[i]) = true;}
 
  a[last_ptr]=NULL;
  print (%s,a) ;
 
  On Jul 23, 12:56 pm, Akshata Sharma akshatasharm...@gmail.com wrote:
 
 
 
 
 
 
 
   better than O(n^2)..
 
   On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma
   akshatasharm...@gmail.comwrote:
 
Given a string *Str of ASCII characters, write the pseudo code to
 remove
the duplicate elements present in them. For example, if the given
 string is
Potato, then, the output has to be Pota. Additional constraint
 is, the
algorithm has to be in-place( no extra data structures allowed) .
 Extend
your algorithm to remove duplicates in the string which consisted of
 UNICODE
characters.

 --
 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: MICROSOFT!!!!

2011-07-23 Thread shady
gcd can always be found in O(log(larger number)) using Euclidean algorithms
, couldn't understand the complexity in that  what's the meaning of
O(log UV)^2 ?

On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana dilipmakwa...@gmail.comwrote:

 @Akshata Sharma


 (2) double full(double a)
 {
return (int)(a+0.5);
 }

 I tried this on DevC++ , with various inputs ; it is working fine 


 On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com wrote:

 What about (2)?, will it always work?


 On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.comwrote:



 the CFG was actually
 s-AB
 A- a| BaB
 B-bbA

 The false statement i guess was This grammar doesnt produce a string
 of 4 consecutive bs


 and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
 rightmost set bit


 pointer related questions were asked.One such was

 (1)int arr[2][3]={{1,2,3},{4,5,6}};
 int (*ptr)[3]=a[0];
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 ptr+=1;
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);

 find the output???

 (2) double full(double a)
 {
return (int)(a+0.5);
 }

 does this always work??

 (3) int x=123,y=231;
int t=0;
int l;
l=x^y;
while(l)
{
t++;
l=l-1;
}
printf(%d,t);

 --
 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.




 --
 *Dilip Makwana*
 VJTI
 BTech Computers Engineering
 2009-2013

 --
 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: MICROSOFT!!!!

2011-07-23 Thread arun kumar
@ shady:the algo posted by naveen ms is better than eulicd algorithm
to find gcd. for more details refer
http://en.wikipedia.org/wiki/Binary_GCD_algorithm

On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
 gcd can always be found in O(log(larger number)) using Euclidean algorithms
 , couldn't understand the complexity in that  what's the meaning of
 O(log UV)^2 ?

 On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana dilipmakwa...@gmail.com
 wrote:

 @Akshata Sharma

 (2) double full(double a)
 {
    return (int)(a+0.5);
 }

 I tried this on DevC++ , with various inputs ; it is working fine 

 On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com wrote:

 What about (2)?, will it always work?

 On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.com
 wrote:


 the CFG was actually
 s-AB
 A- a| BaB
 B-bbA

 The false statement i guess was This grammar doesnt produce a string
 of 4 consecutive bs


 and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
 rightmost set bit


 pointer related questions were asked.One such was

 (1)int arr[2][3]={{1,2,3},{4,5,6}};
 int (*ptr)[3]=a[0];
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 ptr+=1;
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);

 find the output???

 (2) double full(double a)
 {
    return (int)(a+0.5);
 }

 does this always work??

 (3) int x=123,y=231;
    int t=0;
    int l;
    l=x^y;
    while(l)
    {
        t++;
        l=l-1;
    }
    printf(%d,t);

 --
 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.



 --
 Dilip Makwana
 VJTI
 BTech Computers Engineering
 2009-2013

 --
 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.


-- 
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: MICROSOFT!!!!

2011-07-23 Thread arun kumar
the questions were same for intern as well as for placement except for
last one i.e design question which was not there for intern.

On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com wrote:
 @ shady:the algo posted by naveen ms is better than eulicd algorithm
 to find gcd. for more details refer
 http://en.wikipedia.org/wiki/Binary_GCD_algorithm

 On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
 gcd can always be found in O(log(larger number)) using Euclidean algorithms
 , couldn't understand the complexity in that  what's the meaning of
 O(log UV)^2 ?

 On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana dilipmakwa...@gmail.com
 wrote:

 @Akshata Sharma

 (2) double full(double a)
 {
    return (int)(a+0.5);
 }

 I tried this on DevC++ , with various inputs ; it is working fine 

 On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com wrote:

 What about (2)?, will it always work?

 On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.com
 wrote:


 the CFG was actually
 s-AB
 A- a| BaB
 B-bbA

 The false statement i guess was This grammar doesnt produce a string
 of 4 consecutive bs


 and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
 rightmost set bit


 pointer related questions were asked.One such was

 (1)int arr[2][3]={{1,2,3},{4,5,6}};
 int (*ptr)[3]=a[0];
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 ptr+=1;
 printf((%d,%d),(*ptr)[1],(*ptr)[2]);

 find the output???

 (2) double full(double a)
 {
    return (int)(a+0.5);
 }

 does this always work??

 (3) int x=123,y=231;
    int t=0;
    int l;
    l=x^y;
    while(l)
    {
        t++;
        l=l-1;
    }
    printf(%d,t);

 --
 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.



 --
 Dilip Makwana
 VJTI
 BTech Computers Engineering
 2009-2013

 --
 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.



-- 
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: MICROSOFT!!!!

2011-07-23 Thread shady
thanks a lot arun :)

On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com wrote:

 @ shady:the algo posted by naveen ms is better than eulicd algorithm
 to find gcd. for more details refer
 http://en.wikipedia.org/wiki/Binary_GCD_algorithm

 On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
  gcd can always be found in O(log(larger number)) using Euclidean
 algorithms
  , couldn't understand the complexity in that  what's the meaning of
  O(log UV)^2 ?
 
  On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana dilipmakwa...@gmail.com
  wrote:
 
  @Akshata Sharma
 
  (2) double full(double a)
  {
 return (int)(a+0.5);
  }
 
  I tried this on DevC++ , with various inputs ; it is working fine 
 
  On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com
 wrote:
 
  What about (2)?, will it always work?
 
  On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.com
  wrote:
 
 
  the CFG was actually
  s-AB
  A- a| BaB
  B-bbA
 
  The false statement i guess was This grammar doesnt produce a string
  of 4 consecutive bs
 
 
  and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
  rightmost set bit
 
 
  pointer related questions were asked.One such was
 
  (1)int arr[2][3]={{1,2,3},{4,5,6}};
  int (*ptr)[3]=a[0];
  printf((%d,%d),(*ptr)[1],(*ptr)[2]);
  ptr+=1;
  printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 
  find the output???
 
  (2) double full(double a)
  {
 return (int)(a+0.5);
  }
 
  does this always work??
 
  (3) int x=123,y=231;
 int t=0;
 int l;
 l=x^y;
 while(l)
 {
 t++;
 l=l-1;
 }
 printf(%d,t);
 
  --
  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.
 
 
 
  --
  Dilip Makwana
  VJTI
  BTech Computers Engineering
  2009-2013
 
  --
  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.
 

 --
 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] explain plzz:output in file old.out

2011-07-23 Thread arun kumar
oh thanks.

On Sat, Jul 23, 2011 at 11:18 AM, shady sinv...@gmail.com wrote:
 ya, you are right, but it returns -1 when it reaches the end of file.

 On Sat, Jul 23, 2011 at 9:15 AM, arun kumar kumar0...@gmail.com wrote:

 @shady:i have a doubt. scanf returns number of succesfully read words.
 how come it will return -1?

 On Sat, Jul 23, 2011 at 12:17 AM, geek forgeek geekhori...@gmail.com
 wrote:
  @shady and @varun ...
  i hav got it
  thanx both of u  :)
 
  On Fri, Jul 22, 2011 at 11:31 AM, shady sinv...@gmail.com wrote:
 
  @aditi the problem is scanf returns -1(EOF value) when it encounters
  the
  end of file, and inspite of comparing the return value of scanf he is
  comparing value of character 'a' which is not correct
  therefore the for loop should be like this :
  for(int t=scanf(%c,a);t!=EOF;t=scanf(%c,a))
  what varun suggested is another way of doing it :)
 
  On Fri, Jul 22, 2011 at 11:41 PM, aditi garg
  aditi.garg.6...@gmail.com
  wrote:
 
  @shady. so in this case we shud use a!=-1 as the condition??
 
  On Fri, Jul 22, 2011 at 11:37 PM, shady sinv...@gmail.com wrote:
 
  you are scanning from stdin therefore it is not coming out of first
  for
  loop... because your terminating condition is for EOF, which is -1(
  scanf
  returns -1 ) at the end.
 
  On Fri, Jul 22, 2011 at 11:34 PM, shady sinv...@gmail.com wrote:
 
  well you didn't mention the question, directly posted the code with
  no
  head-tail... wait will answer, it is not coming out of first loop
 
  On Fri, Jul 22, 2011 at 11:26 PM, geek forgeek
  geekhori...@gmail.com
  wrote:
 
  @shady this is nt a joke..
  sorry if i am asking too stupid question
  i m getting an infinite loop here.
  not getting how?
 
  On Fri, Jul 22, 2011 at 10:40 AM, shady sinv...@gmail.com wrote:
 
  what kind of joke is this ?
 
  On Fri, Jul 22, 2011 at 11:02 PM, geek forgeek
  geekhori...@gmail.com wrote:
 
  #includestdio.h
  main()
  {
      FILE *fp;
      char a;
      fp=fopen(old.out,w);
      if(fp==0)
          printf(File opening error);
      else
      {
          for(scanf(%c,a);a!=EOF;scanf(%c,a))
          fprintf(fp,%c,a);
          fclose(fp);
          fp=fopen(old.out,r);
          while(!feof(fp))
              putchar(getc(fp));
          }
  }
 
  --
  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.
 
  --
  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.
 
 
 
  --
  Aditi Garg
  Undergraduate Student
  Electronics  Communication Divison
  NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
  Sector 3, Dwarka
  New Delhi
  9718388816
 
  --
  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.
 
  --
  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 

Re: [algogeeks] Re: MS

2011-07-23 Thread pacific :-)
By heapsort i meant : After building the min heap(or max heap) ,we extract
the top of heap and put it at the end of the array constraint to
one condition that if the element already exists at a[heap-size+1] then dont
add just discard and continue.

O(nlogn) and inplace with no extra memory.But even i believe that 26 bits is
not extra memory may be bitmask is better.

On Sat, Jul 23, 2011 at 5:15 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 @ross, I have posted my question in a new thread, not as a reply to any
 existing thread!!!


 On Sat, Jul 23, 2011 at 5:13 PM, ross jagadish1...@gmail.com wrote:

 check for visited can also be implemented by using an integer variable
 and setting corresponding bits!

 On Jul 23, 4:39 pm, ross jagadish1...@gmail.com wrote:
  @akshata sharma:
  Kindly post a new question as a separate thread and not as a reply to
  an existing one so tat it would be noticed by many ppl!
  As akash suggestd, use a bit vector called 'visited' of 26 size for
  ASCII or of a larger size in case of Unicode ( still constant space
  and i dont think declaring 26 variables counts as an additional DS!!),
  if visited then , ignore the character while processing.
  a simple algorithm,
  int last_ptr=0;
  for ( i = 0 - N )
  {
  if(visited(a[i])) continue;
  else a[last_ptr++]=a[i];
  visited(a[i]) = true;}
 
  a[last_ptr]=NULL;
  print (%s,a) ;
 
  On Jul 23, 12:56 pm, Akshata Sharma akshatasharm...@gmail.com wrote:
 
 
 
 
 
 
 
   better than O(n^2)..
 
   On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma
   akshatasharm...@gmail.comwrote:
 
Given a string *Str of ASCII characters, write the pseudo code to
 remove
the duplicate elements present in them. For example, if the given
 string is
Potato, then, the output has to be Pota. Additional constraint
 is, the
algorithm has to be in-place( no extra data structures allowed) .
 Extend
your algorithm to remove duplicates in the string which consisted of
 UNICODE
characters.

 --
 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.




-- 
regards,
chinna.

-- 
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: MICROSOFT!!!!

2011-07-23 Thread saurabh singh
2 will fail for negatve numbers.

On Sat, Jul 23, 2011 at 5:33 PM, shady sinv...@gmail.com wrote:

 thanks a lot arun :)

 On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com wrote:

 @ shady:the algo posted by naveen ms is better than eulicd algorithm
 to find gcd. for more details refer
 http://en.wikipedia.org/wiki/Binary_GCD_algorithm

 On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
  gcd can always be found in O(log(larger number)) using Euclidean
 algorithms
  , couldn't understand the complexity in that  what's the meaning of
  O(log UV)^2 ?
 
  On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana dilipmakwa...@gmail.com
 
  wrote:
 
  @Akshata Sharma
 
  (2) double full(double a)
  {
 return (int)(a+0.5);
  }
 
  I tried this on DevC++ , with various inputs ; it is working fine 
 
  On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com
 wrote:
 
  What about (2)?, will it always work?
 
  On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.com
  wrote:
 
 
  the CFG was actually
  s-AB
  A- a| BaB
  B-bbA
 
  The false statement i guess was This grammar doesnt produce a string
  of 4 consecutive bs
 
 
  and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
  rightmost set bit
 
 
  pointer related questions were asked.One such was
 
  (1)int arr[2][3]={{1,2,3},{4,5,6}};
  int (*ptr)[3]=a[0];
  printf((%d,%d),(*ptr)[1],(*ptr)[2]);
  ptr+=1;
  printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 
  find the output???
 
  (2) double full(double a)
  {
 return (int)(a+0.5);
  }
 
  does this always work??
 
  (3) int x=123,y=231;
 int t=0;
 int l;
 l=x^y;
 while(l)
 {
 t++;
 l=l-1;
 }
 printf(%d,t);
 
  --
  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.
 
 
 
  --
  Dilip Makwana
  VJTI
  BTech Computers Engineering
  2009-2013
 
  --
  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.
 

 --
 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.




-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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

2011-07-23 Thread ankit sambyal
@Pacific : In yr solution order is not preserved.  For example, if the
given string is Potato, then, the output has to be Pota.

-- 
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: MICROSOFT!!!!

2011-07-23 Thread arun kumar
the question was for positive number only.:)

On Sat, Jul 23, 2011 at 5:42 PM, saurabh singh saurab...@gmail.com wrote:
 2 will fail for negatve numbers.

 On Sat, Jul 23, 2011 at 5:33 PM, shady sinv...@gmail.com wrote:

 thanks a lot arun :)

 On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com wrote:

 @ shady:the algo posted by naveen ms is better than eulicd algorithm
 to find gcd. for more details refer
 http://en.wikipedia.org/wiki/Binary_GCD_algorithm

 On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
  gcd can always be found in O(log(larger number)) using Euclidean
  algorithms
  , couldn't understand the complexity in that  what's the meaning of
  O(log UV)^2 ?
 
  On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana
  dilipmakwa...@gmail.com
  wrote:
 
  @Akshata Sharma
 
  (2) double full(double a)
  {
     return (int)(a+0.5);
  }
 
  I tried this on DevC++ , with various inputs ; it is working fine 
 
  On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com
  wrote:
 
  What about (2)?, will it always work?
 
  On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.com
  wrote:
 
 
  the CFG was actually
  s-AB
  A- a| BaB
  B-bbA
 
  The false statement i guess was This grammar doesnt produce a
  string
  of 4 consecutive bs
 
 
  and 2 or 3 questions mainly focused on j=j-1 guess this unsets the
  rightmost set bit
 
 
  pointer related questions were asked.One such was
 
  (1)int arr[2][3]={{1,2,3},{4,5,6}};
  int (*ptr)[3]=a[0];
  printf((%d,%d),(*ptr)[1],(*ptr)[2]);
  ptr+=1;
  printf((%d,%d),(*ptr)[1],(*ptr)[2]);
 
  find the output???
 
  (2) double full(double a)
  {
     return (int)(a+0.5);
  }
 
  does this always work??
 
  (3) int x=123,y=231;
     int t=0;
     int l;
     l=x^y;
     while(l)
     {
         t++;
         l=l-1;
     }
     printf(%d,t);
 
  --
  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.
 
 
 
  --
  Dilip Makwana
  VJTI
  BTech Computers Engineering
  2009-2013
 
  --
  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.
 

 --
 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.



 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


 --
 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: MICROSOFT!!!!

2011-07-23 Thread saurabh singh
where it was written?We had the same question in our MS exam and it was
never mentioned so.

On Sat, Jul 23, 2011 at 5:46 PM, arun kumar kumar0...@gmail.com wrote:

 the question was for positive number only.:)

 On Sat, Jul 23, 2011 at 5:42 PM, saurabh singh saurab...@gmail.com
 wrote:
  2 will fail for negatve numbers.
 
  On Sat, Jul 23, 2011 at 5:33 PM, shady sinv...@gmail.com wrote:
 
  thanks a lot arun :)
 
  On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com
 wrote:
 
  @ shady:the algo posted by naveen ms is better than eulicd algorithm
  to find gcd. for more details refer
  http://en.wikipedia.org/wiki/Binary_GCD_algorithm
 
  On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
   gcd can always be found in O(log(larger number)) using Euclidean
   algorithms
   , couldn't understand the complexity in that  what's the meaning
 of
   O(log UV)^2 ?
  
   On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana
   dilipmakwa...@gmail.com
   wrote:
  
   @Akshata Sharma
  
   (2) double full(double a)
   {
  return (int)(a+0.5);
   }
  
   I tried this on DevC++ , with various inputs ; it is working fine
 
  
   On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com
   wrote:
  
   What about (2)?, will it always work?
  
   On Sat, Jul 23, 2011 at 3:13 AM, prasanth 
 prasanth270...@gmail.com
   wrote:
  
  
   the CFG was actually
   s-AB
   A- a| BaB
   B-bbA
  
   The false statement i guess was This grammar doesnt produce a
   string
   of 4 consecutive bs
  
  
   and 2 or 3 questions mainly focused on j=j-1 guess this unsets
 the
   rightmost set bit
  
  
   pointer related questions were asked.One such was
  
   (1)int arr[2][3]={{1,2,3},{4,5,6}};
   int (*ptr)[3]=a[0];
   printf((%d,%d),(*ptr)[1],(*ptr)[2]);
   ptr+=1;
   printf((%d,%d),(*ptr)[1],(*ptr)[2]);
  
   find the output???
  
   (2) double full(double a)
   {
  return (int)(a+0.5);
   }
  
   does this always work??
  
   (3) int x=123,y=231;
  int t=0;
  int l;
  l=x^y;
  while(l)
  {
  t++;
  l=l-1;
  }
  printf(%d,t);
  
   --
   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.
  
  
  
   --
   Dilip Makwana
   VJTI
   BTech Computers Engineering
   2009-2013
  
   --
   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.
  
 
  --
  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.
 
 
 
  --
  Saurabh Singh
  B.Tech (Computer Science)
  MNNIT ALLAHABAD
 
 
  --
  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 

Re: [algogeeks] Re: MICROSOFT!!!!

2011-07-23 Thread arun kumar
Anna university,chennai

On Sat, Jul 23, 2011 at 5:52 PM, saurabh singh saurab...@gmail.com wrote:
 where it was written?We had the same question in our MS exam and it was
 never mentioned so.

 On Sat, Jul 23, 2011 at 5:46 PM, arun kumar kumar0...@gmail.com wrote:

 the question was for positive number only.:)

 On Sat, Jul 23, 2011 at 5:42 PM, saurabh singh saurab...@gmail.com
 wrote:
  2 will fail for negatve numbers.
 
  On Sat, Jul 23, 2011 at 5:33 PM, shady sinv...@gmail.com wrote:
 
  thanks a lot arun :)
 
  On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com
  wrote:
 
  @ shady:the algo posted by naveen ms is better than eulicd algorithm
  to find gcd. for more details refer
  http://en.wikipedia.org/wiki/Binary_GCD_algorithm
 
  On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
   gcd can always be found in O(log(larger number)) using Euclidean
   algorithms
   , couldn't understand the complexity in that  what's the meaning
   of
   O(log UV)^2 ?
  
   On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana
   dilipmakwa...@gmail.com
   wrote:
  
   @Akshata Sharma
  
   (2) double full(double a)
   {
      return (int)(a+0.5);
   }
  
   I tried this on DevC++ , with various inputs ; it is working fine
   
  
   On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com
   wrote:
  
   What about (2)?, will it always work?
  
   On Sat, Jul 23, 2011 at 3:13 AM, prasanth
   prasanth270...@gmail.com
   wrote:
  
  
   the CFG was actually
   s-AB
   A- a| BaB
   B-bbA
  
   The false statement i guess was This grammar doesnt produce a
   string
   of 4 consecutive bs
  
  
   and 2 or 3 questions mainly focused on j=j-1 guess this unsets
   the
   rightmost set bit
  
  
   pointer related questions were asked.One such was
  
   (1)int arr[2][3]={{1,2,3},{4,5,6}};
   int (*ptr)[3]=a[0];
   printf((%d,%d),(*ptr)[1],(*ptr)[2]);
   ptr+=1;
   printf((%d,%d),(*ptr)[1],(*ptr)[2]);
  
   find the output???
  
   (2) double full(double a)
   {
      return (int)(a+0.5);
   }
  
   does this always work??
  
   (3) int x=123,y=231;
      int t=0;
      int l;
      l=x^y;
      while(l)
      {
          t++;
          l=l-1;
      }
      printf(%d,t);
  
   --
   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.
  
  
  
   --
   Dilip Makwana
   VJTI
   BTech Computers Engineering
   2009-2013
  
   --
   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.
  
 
  --
  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.
 
 
 
  --
  Saurabh Singh
  B.Tech (Computer Science)
  MNNIT ALLAHABAD
 
 
  --
  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 

[algogeeks] C ouput

2011-07-23 Thread Akshata Sharma
main()
{
  int  a[5] = {1,2,3,4,5};
  int *ptr =  (int*)(a+1);

  printf(%d %d , *(a+1), *(ptr-1) );
}

output: 2 5

can someone please exlplain how we are getting 5?

-- 
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: doubt in evaluating in expression

2011-07-23 Thread sagar pareek
sorry for above...typo mistake :-

yup
but what about this
x=3;
y= x++ + ++x + ++x; // it is executed as:-

during first addition, increase the value of x, now first addition will be
4+4 + ++x;
now for second addition it will be like
8+5
hence final value of y=13;
do it by urself

On Sat, Jul 23, 2011 at 6:09 PM, sagar pareek sagarpar...@gmail.com wrote:

 yup
 but what about this
 x=4;
 y= x++ + ++x + ++x; // it is executed as:-

 during first addition, increase the value of x, now first addition will be
 4+4 + ++x;
 now for second addition it will be like
 8+5
 hence final value of y=13;
 do it by urself

 On Sat, Jul 23, 2011 at 2:54 PM, shady sinv...@gmail.com wrote:

 @sagar
 would it get evaluated like this ?
 supposing x = 3;

 y = x++ + ++x; becomes y = (x=x+1) + (x=x+1);
 then x=x+1;

 so x = 5, y = 8;

 On Sat, Jul 23, 2011 at 2:48 PM, sagar pareek sagarpar...@gmail.comwrote:

 @Venga
 if u are doing this
 y= x++ + ++x; //x=3
 then it would be
 like that :-
 ++x; //x=4
 y=x+x;
 x++;

 i thing this is sufficient  :)

 On Sat, Jul 23, 2011 at 1:20 PM, Interstellar Overdrive 
 abhi123khat...@gmail.com wrote:

 The expression y = x++ + x++ + ++y;  is not a valid one. The result is
 compiler dependent
 Read this for reference :http://c-faq.com/expr/seqpoints.html






  --
 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/-/-DWyCxlftwgJ.

 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.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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] C ouput

2011-07-23 Thread Amol Sharma
a denotes the address of array
a+1 increments a by size of array and stores in ptr.i.e. ptr points to
end of array
hence ptr-1 will print 5
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sat, Jul 23, 2011 at 6:03 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 main()
 {
  int  a[5] = {1,2,3,4,5};
  int *ptr =  (int*)(a+1);

  printf(%d %d , *(a+1), *(ptr-1) );
 }

 output: 2 5

 can someone please exlplain how we are getting 5?

 --
 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: doubt in evaluating in expression

2011-07-23 Thread sagar pareek
yup
but what about this
x=4;
y= x++ + ++x + ++x; // it is executed as:-

during first addition, increase the value of x, now first addition will be
4+4 + ++x;
now for second addition it will be like
8+5
hence final value of y=13;
do it by urself

On Sat, Jul 23, 2011 at 2:54 PM, shady sinv...@gmail.com wrote:

 @sagar
 would it get evaluated like this ?
 supposing x = 3;

 y = x++ + ++x; becomes y = (x=x+1) + (x=x+1);
 then x=x+1;

 so x = 5, y = 8;

 On Sat, Jul 23, 2011 at 2:48 PM, sagar pareek sagarpar...@gmail.comwrote:

 @Venga
 if u are doing this
 y= x++ + ++x; //x=3
 then it would be
 like that :-
 ++x; //x=4
 y=x+x;
 x++;

 i thing this is sufficient  :)

 On Sat, Jul 23, 2011 at 1:20 PM, Interstellar Overdrive 
 abhi123khat...@gmail.com wrote:

 The expression y = x++ + x++ + ++y;  is not a valid one. The result is
 compiler dependent
 Read this for reference :http://c-faq.com/expr/seqpoints.html






  --
 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/-/-DWyCxlftwgJ.

 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.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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] C ouput

2011-07-23 Thread sagar pareek
that question was just asked by amazon in mnnit  :)

On Sat, Jul 23, 2011 at 6:10 PM, Amol Sharma amolsharm...@gmail.com wrote:

 a denotes the address of array
 a+1 increments a by size of array and stores in ptr.i.e. ptr points
 to end of array
 hence ptr-1 will print 5
 --


 Amol Sharma
 Third Year Student
 Computer Science and Engineering
 MNNIT Allahabad




 On Sat, Jul 23, 2011 at 6:03 PM, Akshata Sharma akshatasharm...@gmail.com
  wrote:

 main()
 {
  int  a[5] = {1,2,3,4,5};
  int *ptr =  (int*)(a+1);

  printf(%d %d , *(a+1), *(ptr-1) );
 }

 output: 2 5

 can someone please exlplain how we are getting 5?

 --
 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.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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] C ouput

2011-07-23 Thread sukhmeet singh
Amazon ..!! :)
a increments by whole array not just an int value..!!
u marked 2 1 ??

On Sat, Jul 23, 2011 at 6:03 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 main()
 {
  int  a[5] = {1,2,3,4,5};
  int *ptr =  (int*)(a+1);

  printf(%d %d , *(a+1), *(ptr-1) );
 }

 output: 2 5

 can someone please exlplain how we are getting 5?

 --
 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] C ouput

2011-07-23 Thread sukhmeet singh
same here in IIIT !!  :P

On Sat, Jul 23, 2011 at 6:15 PM, sagar pareek sagarpar...@gmail.com wrote:

 that question was just asked by amazon in mnnit  :)


 On Sat, Jul 23, 2011 at 6:10 PM, Amol Sharma amolsharm...@gmail.comwrote:

 a denotes the address of array
 a+1 increments a by size of array and stores in ptr.i.e. ptr points
 to end of array
 hence ptr-1 will print 5
 --


 Amol Sharma
 Third Year Student
 Computer Science and Engineering
 MNNIT Allahabad




 On Sat, Jul 23, 2011 at 6:03 PM, Akshata Sharma 
 akshatasharm...@gmail.com wrote:

 main()
 {
  int  a[5] = {1,2,3,4,5};
  int *ptr =  (int*)(a+1);

  printf(%d %d , *(a+1), *(ptr-1) );
 }

 output: 2 5

 can someone please exlplain how we are getting 5?

 --
 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.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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] C ouput

2011-07-23 Thread Manish Kumar
@Akshata:
Whenever you increase any variable then it increases according to its type.
Here the address of array 'a' is being increased.(  a+1 ).
so the address of 'a' will temporarily increased to 20 bytes and then that
is assigned to ptr.
so ptr is now pointing to any value in the memory just after the memory
where 5 is stored.
so when we print ptr[-1] it prints 5.

I think it should be clear now.
if not,plz let me inform.

-- 
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] C ouput

2011-07-23 Thread radha krishnan
same question in MS written :P


On Sat, Jul 23, 2011 at 5:49 AM, Manish Kumar manish.monu...@gmail.com wrote:
 @Akshata:
 Whenever you increase any variable then it increases according to its type.
 Here the address of array 'a' is being increased.(  a+1 ).
 so the address of 'a' will temporarily increased to 20 bytes and then that
 is assigned to ptr.
 so ptr is now pointing to any value in the memory just after the memory
 where 5 is stored.
 so when we print ptr[-1] it prints 5.
 I think it should be clear now.
 if not,plz let me inform.

 --
 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] C ouput

2011-07-23 Thread ambika iyer
@sagar : what was the question paper pattern for amazon

On Sat, Jul 23, 2011 at 6:32 PM, radha krishnan 
radhakrishnance...@gmail.com wrote:

 same question in MS written :P


 On Sat, Jul 23, 2011 at 5:49 AM, Manish Kumar manish.monu...@gmail.com
 wrote:
  @Akshata:
  Whenever you increase any variable then it increases according to its
 type.
  Here the address of array 'a' is being increased.(  a+1 ).
  so the address of 'a' will temporarily increased to 20 bytes and then
 that
  is assigned to ptr.
  so ptr is now pointing to any value in the memory just after the memory
  where 5 is stored.
  so when we print ptr[-1] it prints 5.
  I think it should be clear now.at
  if not,plz let me inform.
 
  --
  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.




-- 
Ambi :)

-- 
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] Shortest path

2011-07-23 Thread cegprakash
am using Dijkstra's algorithm for www.spoj.pl/TSHPATH

I'm getting WA.
someone plz help me..



#includeiostream
#includestring
#includestdio.h
#includestdlib.h
#includemap
using namespace std;


struct val{
   int from;
   int to;
};

bool operator (val a, val b){
 if(a.from==b.from)
return a.tob.to;
 else
return a.fromb.from;
}

map val , int soln;

map val, bool flags;


map string, int INDEX;

struct COST{
   int from;
   int to;
};

bool operator (COST a, COST b){
 if(a.from==b.from)
 return a.tob.to;
 else
 return a.fromb.from;
}

map COST, int Cost;


struct N{
int n;
int * neigh;
};

bool operator (N a, N b){
return a.neighb.neigh;
}



map int, N neighbour;
mapint, bool visited;





int find(int from,int to,int n){

visited.clear();

int min[10001];


for(int i=1;i=n;i++)
min[i]=999;
min[from]=0;


for(int current=from;;){

   // coutcurrent = currentendl;


   if(current==to)
   break;


   N neighbours= neighbour[current];





   for(int i=1;i=neighbours.n;i++){


   if( !visited[neighbours.neigh[i]] )
   {



   COST p;
   p.from=current;
   p.to=neighbours.neigh[i];

   int temp=min[current]+Cost[p];
   if(temp min[ neighbours.neigh[i] ] )
min[neighbours.neigh[i]]=temp;

 //  coutmin[neighbours.neigh[i]]=
   //  min[neighbours.neigh[i]]endl;

}


   }

   //choose minimum unvisited

   int minn=999,minindex=999;
   for(int i=1;i=n;i++){
  if(i!=currenti!=from!visited[i]){
if(minn min[i]){
  minn=min[i];
  minindex=i;
}

  }
   }

   if(minindex==999){
// for(int i=1;i=n;i++)
  // coutmin[i] ;
 coutendl;
 coutendl;
 return min[to];
   }
   visited[current]=1;


   current=minindex;


}


   // for(int i=1;i=n;i++)
 // coutmin[i] ;
//coutendl;
//coutendl;
return min[to];


}

int *nr;
mapint *, bool addressflag;
int main(){

   int s,n,p,cost,t;
   string name,from,to;
   scanf(%d,s);
   while(s--){
   scanf(%d,n);
   addressflag.clear();
   INDEX.clear();
   Cost.clear();
   flags.clear();
   soln.clear();
   neighbour.clear();
   for(int i=1;i=n;i++)
   {
 addressflag[nr]=1;
again:
 delete(nr);
 nr=new int[10001];
 if(addressflag[nr]==1)
 goto again;

 cinname;
 INDEX[name]=i;
 scanf(%d,p);
 for(int j=1;j=p;j++){
 scanf(%d,nr[j]);

 scanf(%d,cost);
 COST a;
 a.from=i;
 a.to=nr[j];
 Cost[a]=cost;

 }
 N abc;
 abc.n=p;
 abc.neigh=nr;
 neighbour[i]=abc;

   }

  /* for(int i=1;i=n;i++)
   {
 coutneighbours of i are ;

 N all=neighbour[i];
 for(int j=1;j=all.n;j++)
coutall.neigh[j] ;
 coutendl;
   }
   */

   scanf(%d,t);
   while(t--){
   cinfromto;
   coutfind(INDEX[from],INDEX[to],n)endl;

   }

   }


return 0;
}

-- 
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] Shortest path

2011-07-23 Thread cegprakash
I'm trying to solve  www.spoj.pl/problems/TSHPATH

getting WA :(
someone plz gimme a test case where my code fails


[code]#includeiostream
#includestring
#includestdio.h
#includestdlib.h
#includemap
using namespace std;


struct val{
   int from;
   int to;
};

bool operator (val a, val b){
 if(a.from==b.from)
return a.tob.to;
 else
return a.fromb.from;
}

map val , int soln;

map val, bool flags;


map string, int INDEX;

struct COST{
   int from;
   int to;
};

bool operator (COST a, COST b){
 if(a.from==b.from)
 return a.tob.to;
 else
 return a.fromb.from;
}

map COST, int Cost;


struct N{
int n;
int * neigh;
};

bool operator (N a, N b){
return a.neighb.neigh;
}



map int, N neighbour;
mapint, bool visited;





int find(int from,int to,int n){

visited.clear();

int min[10001];


for(int i=1;i=n;i++)
min[i]=999;
min[from]=0;


for(int current=from;;){


   if(current==to)
   break;


   N neighbours= neighbour[current];





   for(int i=1;i=neighbours.n;i++){


   if( !visited[neighbours.neigh[i]] )
   {



   COST p;
   p.from=current;
   p.to=neighbours.neigh[i];

   int temp=min[current]+Cost[p];
   if(temp min[ neighbours.neigh[i] ] )
min[neighbours.neigh[i]]=temp;


}


   }

   //choose minimum unvisited

   int minn=999,minindex=999;
   for(int i=1;i=n;i++){
  if(i!=currenti!=from!visited[i]){
if(minn min[i]){
  minn=min[i];
  minindex=i;
}

  }
   }

   if(minindex==999)//no more nodes left
 return min[to];

   visited[current]=1;


   current=minindex;


}
return min[to];


}

int *nr;
int main(){

   int s,n,p,cost,t;
   string name,from,to;
   scanf(%d,s);
   while(s--){
   scanf(%d,n);
   INDEX.clear();
   Cost.clear();
   flags.clear();
   soln.clear();
   neighbour.clear();
   for(int i=1;i=n;i++)
   {
 delete(nr);
 nr=new int[10001];

 cinname;
 INDEX[name]=i;
 scanf(%d,p);
 for(int j=1;j=p;j++){
 scanf(%d,nr[j]);

 scanf(%d,cost);
 COST a;
 a.from=i;
 a.to=nr[j];
 Cost[a]=cost;

 }
 N abc;
 abc.n=p;
 abc.neigh=nr;
 neighbour[i]=abc;

   }


   scanf(%d,t);
   while(t--){
   cinfromto;
   coutfind(INDEX[from],INDEX[to],n)endl;

   }

   }


return 0;
}
[/code]

-- 
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: Shortest path

2011-07-23 Thread cegprakash
i guess if the starting address of nr is same as any of previous nr's
address when re-allocating it will affect the  bool operator  (N a,N
b) function.. I don't know how to overcome it

so I tried with 2D  static nr[1][1] which led me to
SIGKILL(exceeded memory)

-- 
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] register storage class

2011-07-23 Thread Arshad Alam
Storage for a register storage class variable is allocated each time the
control reaches the block in which it is present. (book Let us C page number
239)
it is true or false please explain


Thanks  Regards
Arshad Nadeem Alam

-- 
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] SPOJ

2011-07-23 Thread viswanath vellaiappan
I agree with Shady on asking for algo for the problem but lets not be hard
on posting spoj question on spoj forum as these too involves algorithm (our
interest).

@KK : Can you tell us the judging status you are hitting? (Wrong answer,
timeout??).


~Viswanath.

On Sat, Jul 23, 2011 at 4:57 PM, shady sinv...@gmail.com wrote:

 there's something called spoj forum, try posting it there
 secondly, ask whether ur algo is right or wrong, not the code


 On Sat, Jul 23, 2011 at 4:51 PM, KK kunalkapadi...@gmail.com wrote:

 www.spoj.pl/problems/SHOP
 Its a pretty easy Q... But m not able to figure out any silly mistake
 in my prog.. plzz help

 #includeiostream
 #includevector
 #includemap
 #includequeue

 using namespace std;

 char a[26][26];
 int si, sj, di, dj, rows, cols;

 void BFS(vector vectorint  v, int si, int sj, int rows, int
 cols);
 int safe(vector vectorint  v, int r, int c, int current, int
 rows, int cols);

 int main()
 {
freopen(input.txt, r, stdin);
freopen(output.txt, w, stdout);

int si, sj;
while(1)
{
 cin  cols  rows;

 if(rows == 0  cols == 0)
  break;

 vectorint row(26, INT_MAX);
 vector vectorint  final(26, row);

 for(int i=0; irows; i++)
   for(int j=0; jcols; j++)
   {
  cin  a[i][j];
  if(a[i][j] == 'S')
  {
 si = i; sj = j;
  }
  else if(a[i][j] == 'D')
  {
 di = i; dj = j;
 a[i][j] = '0';
  }
   }

 BFS(final, si, sj, rows, cols);
 cout  final[di][dj]  endl;

 /*
 for(int i=0; irows; i++)
 {
   for(int j=0; jcols; j++)
  cout  final[i][j]   ;
   cout  endl;
 }
 cout  endl;
 */
}
return 0;
 }

 void BFS(vector vectorint  v, int si, int sj, int rows, int cols)
 {
 pairint, int p;
 queue pairint, int  q;

 q.push(make_pair(si, sj));
 v[si][sj] = 0;

 while(!q.empty())
 {
  p = q.front();   q.pop();
  int current = v[p.first][p.second];

  if(safe(v, p.first+1, p.second, current, rows, cols))
   q.push(make_pair(p.first+1, p.second));

  if(safe(v, p.first-1, p.second, current, rows, cols))
   q.push(make_pair(p.first-1, p.second));

  if(safe(v, p.first, p.second+1, current, rows, cols))
   q.push(make_pair(p.first, p.second+1));

  if(safe(v, p.first, p.second-1, current, rows, cols))
   q.push(make_pair(p.first, p.second-1));

 }
 }

 int safe(vector vectorint  v, int r, int c, int current, int
 rows, int cols)
 {
if(r = 0  r  rows  c = 0  c  cols  a[r][c] != 'X')
{
 if(v[r][c]  current + a[r][c] - '0')
 {
 v[r][c] = current + a[r][c] - '0';
 return 1;
 }

}
return 0;
 }

 --
 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.


-- 
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] C ouput

2011-07-23 Thread Akshata Sharma
Thanks all :) its clear now..

On Sat, Jul 23, 2011 at 6:37 PM, ambika iyer balu200...@gmail.com wrote:

 @sagar : what was the question paper pattern for amazon

 On Sat, Jul 23, 2011 at 6:32 PM, radha krishnan 
 radhakrishnance...@gmail.com wrote:

 same question in MS written :P


 On Sat, Jul 23, 2011 at 5:49 AM, Manish Kumar manish.monu...@gmail.com
 wrote:
  @Akshata:
  Whenever you increase any variable then it increases according to its
 type.
  Here the address of array 'a' is being increased.(  a+1 ).
  so the address of 'a' will temporarily increased to 20 bytes and then
 that
  is assigned to ptr.
  so ptr is now pointing to any value in the memory just after the memory
  where 5 is stored.
  so when we print ptr[-1] it prints 5.
  I think it should be clear now.at

  if not,plz let me inform.
 
  --
  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.




 --
 Ambi :)

 --
 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] output plzz

2011-07-23 Thread geek forgeek
#includestdio.h
main()
{
int i=3;
switch(i)
{
do
{
case 3: printf(\nhello);
case 2:printf(\n h);
break;
case 1:printf(wat);
break;
case 0: printf(hai);
}while(i--);
}
}

-- 
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] output plzz

2011-07-23 Thread saurabh singh
The break statement here breaks out of the do loop so the o/p hello hmmm
give a break statement after hello and you will get only hello.

PS:Seeing the number of C questions wont it be a better idea to start a
parallel group especially for the same?My request to the group admins for
the same.

On Sat, Jul 23, 2011 at 8:47 PM, geek forgeek geekhori...@gmail.com wrote:

 #includestdio.h
 main()
 {
 int i=3;
 switch(i)
 {
 do
 {
 case 3: printf(\nhello);
 case 2:printf(\n h);
 break;
 case 1:printf(wat);
 break;
 case 0: printf(hai);
 }while(i--);
 }
 }

 --
 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.




-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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] output plzz

2011-07-23 Thread shady
nice idea Saurabh, but i don't think much people will join that group too,
and the difference should be on the basis of type of questions asked. Any
suggestions from others ? There we can ask questions related to debugging
and puzzles, aptitude

On Sat, Jul 23, 2011 at 8:51 PM, saurabh singh saurab...@gmail.com wrote:

 The break statement here breaks out of the do loop so the o/p hello hmmm
 give a break statement after hello and you will get only hello.

 PS:Seeing the number of C questions wont it be a better idea to start a
 parallel group especially for the same?My request to the group admins for
 the same.


 On Sat, Jul 23, 2011 at 8:47 PM, geek forgeek geekhori...@gmail.comwrote:

 #includestdio.h
 main()
 {
 int i=3;
 switch(i)
 {
 do
 {
 case 3: printf(\nhello);
 case 2:printf(\n h);
 break;
 case 1:printf(wat);
 break;
 case 0: printf(hai);
 }while(i--);
 }
 }

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 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] output plzz

2011-07-23 Thread sameer.mut...@gmail.com
@shady: yes its a good idea to have aptitude puzzles etc in other group

On Sat, Jul 23, 2011 at 8:29 AM, shady sinv...@gmail.com wrote:

 nice idea Saurabh, but i don't think much people will join that group too,
 and the difference should be on the basis of type of questions asked. Any
 suggestions from others ? There we can ask questions related to debugging
 and puzzles, aptitude


 On Sat, Jul 23, 2011 at 8:51 PM, saurabh singh saurab...@gmail.comwrote:

 The break statement here breaks out of the do loop so the o/p hello hmmm
 give a break statement after hello and you will get only hello.

 PS:Seeing the number of C questions wont it be a better idea to start a
 parallel group especially for the same?My request to the group admins for
 the same.


 On Sat, Jul 23, 2011 at 8:47 PM, geek forgeek geekhori...@gmail.comwrote:

 #includestdio.h
 main()
 {
 int i=3;
 switch(i)
 {
 do
 {
 case 3: printf(\nhello);
 case 2:printf(\n h);
 break;
 case 1:printf(wat);
 break;
 case 0: printf(hai);
 }while(i--);
 }
 }

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 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.


-- 
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] register storage class

2011-07-23 Thread prabhu J
ya its true. refer let us c solutions page no. 167

On Sat, Jul 23, 2011 at 8:28 PM, Arshad Alam alam3...@gmail.com wrote:

 Storage for a register storage class variable is allocated each time the
 control reaches the block in which it is present. (book Let us C page number
 239)
 it is true or false please explain


 Thanks  Regards
 Arshad Nadeem Alam

  --
 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] output plzz

2011-07-23 Thread geek forgeek
even i second this gud idea

On Sat , Jul 23, 2011 at 8:40 AM, sameer.mut...@gmail.com 
sameer.mut...@gmail.com wrote:

 @shady: yes its a good idea to have aptitude puzzles etc in other group


 On Sat, Jul 23, 2011 at 8:29 AM, shady sinv...@gmail.com wrote:

 nice idea Saurabh, but i don't think much people will join that group too,
 and the difference should be on the basis of type of questions asked. Any
 suggestions from others ? There we can ask questions related to debugging
 and puzzles, aptitude


 On Sat, Jul 23, 2011 at 8:51 PM, saurabh singh saurab...@gmail.comwrote:

 The break statement here breaks out of the do loop so the o/p hello hmmm
 give a break statement after hello and you will get only hello.

 PS:Seeing the number of C questions wont it be a better idea to start a
 parallel group especially for the same?My request to the group admins for
 the same.


 On Sat, Jul 23, 2011 at 8:47 PM, geek forgeek geekhori...@gmail.comwrote:

 #includestdio.h
 main()
 {
 int i=3;
 switch(i)
 {
 do
 {
 case 3: printf(\nhello);
 case 2:printf(\n h);
 break;
 case 1:printf(wat);
 break;
 case 0: printf(hai);
 }while(i--);
 }
 }

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 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.


  --
 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] output plzz

2011-07-23 Thread shady
I will get back to you tomorrow. Thanks a lot for the feedback :)
Probably can have some contests organized as well, once a month on online
judges..( no prizes though )

On Sat, Jul 23, 2011 at 9:21 PM, geek forgeek geekhori...@gmail.com wrote:

 even i second this gud idea


 On Sat , Jul 23, 2011 at 8:40 AM, sameer.mut...@gmail.com 
 sameer.mut...@gmail.com wrote:

 @shady: yes its a good idea to have aptitude puzzles etc in other group


 On Sat, Jul 23, 2011 at 8:29 AM, shady sinv...@gmail.com wrote:

 nice idea Saurabh, but i don't think much people will join that group
 too, and the difference should be on the basis of type of questions asked.
 Any suggestions from others ? There we can ask questions related to
 debugging and puzzles, aptitude


 On Sat, Jul 23, 2011 at 8:51 PM, saurabh singh saurab...@gmail.comwrote:

 The break statement here breaks out of the do loop so the o/p hello hmmm
 give a break statement after hello and you will get only hello.

 PS:Seeing the number of C questions wont it be a better idea to start a
 parallel group especially for the same?My request to the group admins for
 the same.


 On Sat, Jul 23, 2011 at 8:47 PM, geek forgeek geekhori...@gmail.comwrote:

 #includestdio.h
 main()
 {
 int i=3;
 switch(i)
 {
 do
 {
 case 3: printf(\nhello);
 case 2:printf(\n h);
 break;
 case 1:printf(wat);
 break;
 case 0: printf(hai);
 }while(i--);
 }
 }

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 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.


  --
 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.


-- 
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] register storage class

2011-07-23 Thread Arshad Alam
@Prabhu.. I don't have Let Us C solution..if you have soft copy.. can you
please send..

On Sat, Jul 23, 2011 at 9:12 PM, prabhu J j.prabh...@gmail.com wrote:

 ya its true. refer let us c solutions page no. 167

 On Sat, Jul 23, 2011 at 8:28 PM, Arshad Alam alam3...@gmail.com wrote:

 Storage for a register storage class variable is allocated each time the
 control reaches the block in which it is present. (book Let us C page number
 239)
 it is true or false please explain


 Thanks  Regards
 Arshad Nadeem Alam

  --
 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.


-- 
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] SPOJ

2011-07-23 Thread Piyush Kapoor
What will happen if r=di,c=dj in your safe function,I think that is causing
the error...

On Sat, Jul 23, 2011 at 8:29 PM, viswanath vellaiappan 
viswanath.vellaiap...@gmail.com wrote:

 I agree with Shady on asking for algo for the problem but lets not be hard
 on posting spoj question on spoj forum as these too involves algorithm (our
 interest).

 @KK : Can you tell us the judging status you are hitting? (Wrong answer,
 timeout??).


 ~Viswanath.


 On Sat, Jul 23, 2011 at 4:57 PM, shady sinv...@gmail.com wrote:

 there's something called spoj forum, try posting it there
 secondly, ask whether ur algo is right or wrong, not the code


 On Sat, Jul 23, 2011 at 4:51 PM, KK kunalkapadi...@gmail.com wrote:

 www.spoj.pl/problems/SHOP
 Its a pretty easy Q... But m not able to figure out any silly mistake
 in my prog.. plzz help

 #includeiostream
 #includevector
 #includemap
 #includequeue

 using namespace std;

 char a[26][26];
 int si, sj, di, dj, rows, cols;

 void BFS(vector vectorint  v, int si, int sj, int rows, int
 cols);
 int safe(vector vectorint  v, int r, int c, int current, int
 rows, int cols);

 int main()
 {
freopen(input.txt, r, stdin);
freopen(output.txt, w, stdout);

int si, sj;
while(1)
{
 cin  cols  rows;

 if(rows == 0  cols == 0)
  break;

 vectorint row(26, INT_MAX);
 vector vectorint  final(26, row);

 for(int i=0; irows; i++)
   for(int j=0; jcols; j++)
   {
  cin  a[i][j];
  if(a[i][j] == 'S')
  {
 si = i; sj = j;
  }
  else if(a[i][j] == 'D')
  {
 di = i; dj = j;
 a[i][j] = '0';
  }
   }

 BFS(final, si, sj, rows, cols);
 cout  final[di][dj]  endl;

 /*
 for(int i=0; irows; i++)
 {
   for(int j=0; jcols; j++)
  cout  final[i][j]   ;
   cout  endl;
 }
 cout  endl;
 */
}
return 0;
 }

 void BFS(vector vectorint  v, int si, int sj, int rows, int cols)
 {
 pairint, int p;
 queue pairint, int  q;

 q.push(make_pair(si, sj));
 v[si][sj] = 0;

 while(!q.empty())
 {
  p = q.front();   q.pop();
  int current = v[p.first][p.second];

  if(safe(v, p.first+1, p.second, current, rows, cols))
   q.push(make_pair(p.first+1, p.second));

  if(safe(v, p.first-1, p.second, current, rows, cols))
   q.push(make_pair(p.first-1, p.second));

  if(safe(v, p.first, p.second+1, current, rows, cols))
   q.push(make_pair(p.first, p.second+1));

  if(safe(v, p.first, p.second-1, current, rows, cols))
   q.push(make_pair(p.first, p.second-1));

 }
 }

 int safe(vector vectorint  v, int r, int c, int current, int
 rows, int cols)
 {
if(r = 0  r  rows  c = 0  c  cols  a[r][c] != 'X')
{
 if(v[r][c]  current + a[r][c] - '0')
 {
 v[r][c] = current + a[r][c] - '0';
 return 1;
 }

}
return 0;
 }

 --
 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.


  --
 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.




-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

-- 
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] register storage class

2011-07-23 Thread radha krishnan
Ok ! ppl started asking about books and send it to me :P
stop this thread :P

On Sat, Jul 23, 2011 at 8:56 AM, Arshad Alam alam3...@gmail.com wrote:
 @Prabhu.. I don't have Let Us C solution..if you have soft copy.. can you
 please send..

 On Sat, Jul 23, 2011 at 9:12 PM, prabhu J j.prabh...@gmail.com wrote:

 ya its true. refer let us c solutions page no. 167

 On Sat, Jul 23, 2011 at 8:28 PM, Arshad Alam alam3...@gmail.com wrote:

 Storage for a register storage class variable is allocated each time the
 control reaches the block in which it is present. (book Let us C page number
 239)
 it is true or false please explain


 Thanks  Regards
 Arshad Nadeem Alam

 --
 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.

 --
 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] output plzz

2011-07-23 Thread geek forgeek
#includestdio.h
main()
{
char outline[50];
char one[7],two[7],four[7],five[7];
int three;
sprintf(outline,this is %d times %s \n,10,charlie);
printf(%s,outline);
sscanf(outline,%s %s %d %s %s,one,two,three,four,five);
printf(%s,one);
printf(%s,two);
printf(%d,three);
printf(%s,four);
printf(%s,five);
}

-- 
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: stacks

2011-07-23 Thread Pankaj
Can you please tell us from where we can find such questions?

On Sat, Jul 23, 2011 at 4:21 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:

 Nice question Kamakshi. The person above has given almost a perfect answer.

 For example i=3, we will pop the elements one by one from the top of the
 1st stack and pushed to the 2nd stack until the value (top - i) is reached.


 On Sat, Jul 23, 2011 at 3:52 PM, ross jagadish1...@gmail.com wrote:

 Well. the idea of an array is - given an integer 'i', you should
 support RANDOM ACCESS to the ith element in the 1d array.
 Since, we have two stacks, if you want to access an ith element ( say,
 i = 5 ),pop all the top 4 elements from the 1st stack and push it to
 the second stack.
 Now, access the 5th element on top of the 1st stack, then, pop the
 elements from the 2nd stack back and push them to the 1st stack.
 However, access is O(n) due to the inherent property of a stack which
 forbids random access!


 On Jul 23, 2:00 pm, Kamakshii Aggarwal kamakshi...@gmail.com wrote:
  consider a language that does no have arrays...but u can define stack
 data
  type like
  stack s;
  using pop ,push and other operations on  2 stacks,how can one dimensions
  array can be implemented??
 
  --
  Regards,
  Kamakshi
  kamakshi...@gmail.com

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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] MS Written Test

2011-07-23 Thread wats my name for 2day
Hi,
Following question was asked in MS writtentest today in Bangalore(off
campus)

Give an algo to count the occurances of all words in a document. You
are
given a method chat * GetNextWord, that returns the next word from the
document.

1. Which Data Structure will you use so that the algo is very fast?
2.What is the order?

-- 
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] Prime Numbers

2011-07-23 Thread frank
what is the efficient algorith to find the prime numbers or to check a
number prime or not ?
Helpful if the pseudo code provided.

thank you

-- 
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] Prime Numbers

2011-07-23 Thread arun kumar
hope this link will help you
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=primalityTesting

On Sat, Jul 23, 2011 at 10:39 PM, frank abb...@gmail.com wrote:
 what is the efficient algorith to find the prime numbers or to check a
 number prime or not ?
 Helpful if the pseudo code provided.

thank you

 --
 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] MS Written Test

2011-07-23 Thread ankit sambyal
Use hashing with the words as key. Store the string of the word as the value..

-- 
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] output plzz

2011-07-23 Thread saurabh singh
Anyways just share the link on the group.I am pretty sure the interested
will join.No offences but sometimes it does get irritating when you open a
post with subject Help! and when you expect some good algorithm problem you
find questions like -x=++x---x+++x---x;whats the output.
Whatever you decide please make it clear about what exactly the new group
will be about(If at all you decide to make one.)

PS:Thanks for the reply.

On Sat, Jul 23, 2011 at 9:25 PM, shady sinv...@gmail.com wrote:

 I will get back to you tomorrow. Thanks a lot for the feedback :)
 Probably can have some contests organized as well, once a month on online
 judges..( no prizes though )

 On Sat, Jul 23, 2011 at 9:21 PM, geek forgeek geekhori...@gmail.comwrote:

 even i second this gud idea


 On Sat , Jul 23, 2011 at 8:40 AM, sameer.mut...@gmail.com 
 sameer.mut...@gmail.com wrote:

 @shady: yes its a good idea to have aptitude puzzles etc in other group


 On Sat, Jul 23, 2011 at 8:29 AM, shady sinv...@gmail.com wrote:

 nice idea Saurabh, but i don't think much people will join that group
 too, and the difference should be on the basis of type of questions asked.
 Any suggestions from others ? There we can ask questions related to
 debugging and puzzles, aptitude


 On Sat, Jul 23, 2011 at 8:51 PM, saurabh singh saurab...@gmail.comwrote:

 The break statement here breaks out of the do loop so the o/p hello
 hmmm
 give a break statement after hello and you will get only hello.

 PS:Seeing the number of C questions wont it be a better idea to start a
 parallel group especially for the same?My request to the group admins for
 the same.


 On Sat, Jul 23, 2011 at 8:47 PM, geek forgeek 
 geekhori...@gmail.comwrote:

 #includestdio.h
 main()
 {
 int i=3;
 switch(i)
 {
 do
 {
 case 3: printf(\nhello);
 case 2:printf(\n h);
 break;
 case 1:printf(wat);
 break;
 case 0: printf(hai);
 }while(i--);
 }
 }

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 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.


  --
 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.


  --
 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.




-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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] MS Written Test

2011-07-23 Thread rajeev bharshetty
Trie data structure can be used ? What you say guys??

On Sat, Jul 23, 2011 at 10:43 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 Use hashing with the words as key. Store the string of the word as the
 value..

 --
 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.




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

-- 
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] MS Written Test

2011-07-23 Thread wats my name for 2day
@ankit, rajeev
even I wrote hashtable as the answer ..

but which would be faster? Hashtabel or Trie?

-- 
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] MS Written Test

2011-07-23 Thread saurabh singh
Hashtable o(1) trie atleast o(logn)

On Sat, Jul 23, 2011 at 11:05 PM, wats my name for 2day lok...@gmail.comwrote:

 @ankit, rajeev
 even I wrote hashtable as the answer ..

 but which would be faster? Hashtabel or Trie?

 --
 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.




-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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] MS Written Test

2011-07-23 Thread varun pahwa
I think regarding memory trie would be better.

On Sat, Jul 23, 2011 at 11:08 PM, saurabh singh saurab...@gmail.com wrote:

 Hashtable o(1) trie atleast o(logn)


 On Sat, Jul 23, 2011 at 11:05 PM, wats my name for 2day 
 lok...@gmail.comwrote:

 @ankit, rajeev
 even I wrote hashtable as the answer ..

 but which would be faster? Hashtabel or Trie?

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD



  --
 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.




-- 
Varun Pahwa
B.Tech (IT)
7th Sem.
Indian Institute of Information Technology Allahabad.
Ph : 09793899112
Official Email :: rit2008...@iiita.ac.in
Another Email :: varunpahwa.ii...@gmail.com

People who fail to plan are those who plan to fail.

-- 
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] MS Written Test

2011-07-23 Thread rajeev bharshetty
It all depends on the distribution of words and their frequencies in the
input file.
But although somewhere I feel trie is better (i mean in terms of
flexibility).
Although a lot of pointers have to be maintained in trie , it really
provides an optimal solution for this problem .

On Sat, Jul 23, 2011 at 11:08 PM, saurabh singh saurab...@gmail.com wrote:

 Hashtable o(1) trie atleast o(logn)


 On Sat, Jul 23, 2011 at 11:05 PM, wats my name for 2day 
 lok...@gmail.comwrote:

 @ankit, rajeev
 even I wrote hashtable as the answer ..

 but which would be faster? Hashtabel or Trie?

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD



  --
 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.




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

-- 
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] atoi()

2011-07-23 Thread rShetty
Give an algorithm to implement an atoi() function ?

-- 
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: doubt in evaluating in expression

2011-07-23 Thread Arun Vishwanathan
@sagar: if what u said previously holds as in when u say y=x++ + ++x is
evaluated as 4+4 since ++x results in 4 and 4 is used in x++ too (cos post
increment increments x later) then for y=x++ + ++x + ++x with x beginning as
3 shud the expression not be evaluated as 5+5+4( from rhs ++x does a 3 to 4
and another ++x does 4 to 5 and 5 is used in x++) .later x becomes 6 ?



On Sat, Jul 23, 2011 at 2:39 PM, sagar pareek sagarpar...@gmail.com wrote:

 sorry for above...typo mistake :-

 yup
 but what about this
 x=3;
 y= x++ + ++x + ++x; // it is executed as:-

 during first addition, increase the value of x, now first addition will be
 4+4 + ++x;
 now for second addition it will be like
 8+5
 hence final value of y=13;
 do it by urself

 On Sat, Jul 23, 2011 at 6:09 PM, sagar pareek sagarpar...@gmail.comwrote:

 yup
 but what about this
 x=4;
 y= x++ + ++x + ++x; // it is executed as:-

 during first addition, increase the value of x, now first addition will be
 4+4 + ++x;
 now for second addition it will be like
 8+5
 hence final value of y=13;
 do it by urself

 On Sat, Jul 23, 2011 at 2:54 PM, shady sinv...@gmail.com wrote:

 @sagar
 would it get evaluated like this ?
 supposing x = 3;

 y = x++ + ++x; becomes y = (x=x+1) + (x=x+1);
 then x=x+1;

 so x = 5, y = 8;

 On Sat, Jul 23, 2011 at 2:48 PM, sagar pareek sagarpar...@gmail.comwrote:

 @Venga
 if u are doing this
 y= x++ + ++x; //x=3
 then it would be
 like that :-
 ++x; //x=4
 y=x+x;
 x++;

 i thing this is sufficient  :)

 On Sat, Jul 23, 2011 at 1:20 PM, Interstellar Overdrive 
 abhi123khat...@gmail.com wrote:

 The expression y = x++ + x++ + ++y;  is not a valid one. The result is
 compiler dependent
 Read this for reference :http://c-faq.com/expr/seqpoints.html






  --
 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/-/-DWyCxlftwgJ.

 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.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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.




-- 
Arun Vish
Graduate Student
Department of Computer Science
University of Southern California

-- 
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] MS Written Test

2011-07-23 Thread hary rathor
no aditional data structure is required , if we search in directly on input
stream.
by using Boyer-Moore string search
algorithmhttp://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm.
it take Ω(n/m) or O(n).
so we do it on the fly.

Hash function has also some prolem in where target word are anagram of src
word.

-- 
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 Evaluating Expression

2011-07-23 Thread shady
Does anyone know how to simplify the expression for this problem ?
https://www.spoj.pl/problems/EXFOR/ To get AC for this problem we can always
solve the expression, which is bruteforce, any other better way ?
Mathematician's way ?

-- 
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] atoi()

2011-07-23 Thread hary rathor
int number=0;
read linearly



if(ch=='-'||ch=='+')
number=-1;

ch=str[i];
chack every char is

if(ch'0'ch'9') then
number =number *10+ch-'0';

-- 
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] atoi()

2011-07-23 Thread Gaurav Popli
and also ignore starting spaces if dr is any...

On Sun, Jul 24, 2011 at 12:55 AM, hary rathor harry.rat...@gmail.com wrote:
 int number=0;
 read linearly



 if(ch=='-'||ch=='+')
 number=-1;

 ch=str[i];
 chack every char is

 if(ch'0'ch'9') then
 number =number *10+ch-'0';


 --
 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: stacks

2011-07-23 Thread Gaurav Popli
it is given in tanenbaum

On Sat, Jul 23, 2011 at 9:49 PM, Pankaj jatka.oppimi...@gmail.com wrote:
 Can you please tell us from where we can find such questions?

 On Sat, Jul 23, 2011 at 4:21 PM, Nikhil Gupta nikhilgupta2...@gmail.com
 wrote:

 Nice question Kamakshi. The person above has given almost a perfect
 answer.
 For example i=3, we will pop the elements one by one from the top of the
 1st stack and pushed to the 2nd stack until the value (top - i) is reached.

 On Sat, Jul 23, 2011 at 3:52 PM, ross jagadish1...@gmail.com wrote:

 Well. the idea of an array is - given an integer 'i', you should
 support RANDOM ACCESS to the ith element in the 1d array.
 Since, we have two stacks, if you want to access an ith element ( say,
 i = 5 ),pop all the top 4 elements from the 1st stack and push it to
 the second stack.
 Now, access the 5th element on top of the 1st stack, then, pop the
 elements from the 2nd stack back and push them to the 1st stack.
 However, access is O(n) due to the inherent property of a stack which
 forbids random access!


 On Jul 23, 2:00 pm, Kamakshii Aggarwal kamakshi...@gmail.com wrote:
  consider a language that does no have arrays...but u can define stack
  data
  type like
  stack s;
  using pop ,push and other operations on  2 stacks,how can one
  dimensions
  array can be implemented??
 
  --
  Regards,
  Kamakshi
  kamakshi...@gmail.com

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

 --
 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.


-- 
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] output plzz

2011-07-23 Thread Pankaj
+1.
The new group should only contain stuff related to C output and error
detection and ques like that.
Puzzles I think can be discussed here. wattsay?

On Sat, Jul 23, 2011 at 10:44 PM, saurabh singh saurab...@gmail.com wrote:

 Anyways just share the link on the group.I am pretty sure the interested
 will join.No offences but sometimes it does get irritating when you open a
 post with subject Help! and when you expect some good algorithm problem you
 find questions like -x=++x---x+++x---x;whats the output.
 Whatever you decide please make it clear about what exactly the new group
 will be about(If at all you decide to make one.)

 PS:Thanks for the reply.


 On Sat, Jul 23, 2011 at 9:25 PM, shady sinv...@gmail.com wrote:

 I will get back to you tomorrow. Thanks a lot for the feedback :)
 Probably can have some contests organized as well, once a month on online
 judges..( no prizes though )

 On Sat, Jul 23, 2011 at 9:21 PM, geek forgeek geekhori...@gmail.comwrote:

 even i second this gud idea


 On Sat , Jul 23, 2011 at 8:40 AM, sameer.mut...@gmail.com 
 sameer.mut...@gmail.com wrote:

 @shady: yes its a good idea to have aptitude puzzles etc in other group


 On Sat, Jul 23, 2011 at 8:29 AM, shady sinv...@gmail.com wrote:

 nice idea Saurabh, but i don't think much people will join that group
 too, and the difference should be on the basis of type of questions asked.
 Any suggestions from others ? There we can ask questions related to
 debugging and puzzles, aptitude


 On Sat, Jul 23, 2011 at 8:51 PM, saurabh singh saurab...@gmail.comwrote:

 The break statement here breaks out of the do loop so the o/p hello
 hmmm
 give a break statement after hello and you will get only hello.

 PS:Seeing the number of C questions wont it be a better idea to start
 a parallel group especially for the same?My request to the group admins 
 for
 the same.


 On Sat, Jul 23, 2011 at 8:47 PM, geek forgeek 
 geekhori...@gmail.comwrote:

 #includestdio.h
 main()
 {
 int i=3;
 switch(i)
 {
 do
 {
 case 3: printf(\nhello);
 case 2:printf(\n h);
 break;
 case 1:printf(wat);
 break;
 case 0: printf(hai);
 }while(i--);
 }
 }

 --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 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.


  --
 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.


  --
 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD


  --
 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 

Re: [algogeeks] SPOJ Problem Evaluating Expression

2011-07-23 Thread SAMM
It forms a pattern for each combination i solved it tht way in spoj.

On 7/24/11, shady sinv...@gmail.com wrote:
 Does anyone know how to simplify the expression for this problem ?
 https://www.spoj.pl/problems/EXFOR/ To get AC for this problem we can always
 solve the expression, which is bruteforce, any other better way ?
 Mathematician's way ?

 --
 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.




-- 
Somnath Singh

-- 
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] output plzz

2011-07-23 Thread Anika Jain
in this in scanf one,two, four five will b thr, no  thr..

and sumbody plz tell afterwards this change why the o/p is
this is 10 times charlie
thisis10charlie

why in 'four' empty string is going??

On Sat, Jul 23, 2011 at 9:37 PM, geek forgeek geekhori...@gmail.com wrote:

 #includestdio.h
 main()
 {
 char outline[50];
 char one[7],two[7],four[7],five[7];
 int three;
 sprintf(outline,this is %d times %s \n,10,charlie);
 printf(%s,outline);
 sscanf(outline,%s %s %d %s %s,one,two,three,four,five);
 printf(%s,one);
 printf(%s,two);
 printf(%d,three);
 printf(%s,four);
 printf(%s,five);
 }

  --
 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] Interleaving two strings using recursion

2011-07-23 Thread BL
Hi,
Given two strings s and t of distinct characters print out all
interleavings of the characters in the two strings using recursion.
Does anybody know a suitable algorithm that could be used for this
task?

Thank you in advance.
BL

-- 
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.



  1   2   >