Re: [algogeeks] Give Algo to do this in O(n)

2011-10-10 Thread snehi jain
ankur : i wont say its the best way, but it can be used in one traversal the range can be determined and then count sort can be applied. On Mon, Oct 10, 2011 at 10:56 PM, Ankur Garg wrote: > @Sravan ..Counting Sort takes O(n) time but it needs range of nos to be > known &g

Re: [algogeeks] Give Algo to do this in O(n)

2011-10-10 Thread snehi jain
@ ankur: if space is not the consideration first sort them using count sort and then look for the pair with the min. difference .. i think it should work . Snehi On Mon, Oct 10, 2011 at 7:21 PM, anubhav gupta wrote: > @deoki try for 1001,999,998,1 > > > On Mon, Oct 10, 2011 at 6:57 PM, Deok

Re: [algogeeks] Re: Make My Trip *URGENT*

2011-08-18 Thread snehi jain
after the aptitude written round .. there were 15 questions in technical (c & c++) and 5 questions on coding in 45 min. On Thu, Aug 18, 2011 at 11:01 PM, Anika Jain wrote: > the level is very easy.. i dont remember the questions .. but they are > easy.. but tht makes cut off go very high > > On

Re: [algogeeks] Makemytrip.com

2011-08-05 Thread snehi jain
thanks for the information .. the technical round had MCQs or coding questions ?? On Fri, Aug 5, 2011 at 11:09 PM, parag khanna wrote: > CS,IT,ECE > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to

[algogeeks] a C question

2011-08-05 Thread snehi jain
#include main() { long x; float t; scanf("%f",&t); printf("%d\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); getch(); } o/p (when i had given input as 67 this is the output) 0 67.0 67.0 67.0 67.0

Re: [algogeeks] Makemytrip.com

2011-08-05 Thread snehi jain
NIT kurukshetra people ... could post some information regarding the procedure followed by makemytrip during their recruitment process ... On Sat, Jul 30, 2011 at 1:51 AM, sukhmeet singh wrote: > CTC ??? > > > On Thu, Jul 28, 2011 at 10:22 PM, Raman Gugnani < > ramangugnani@gmail.com> wrote

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread snehi jain
no problem .. but can u find a bug in this technique .. On Fri, Jul 29, 2011 at 8:17 PM, saurabh singh wrote: > ignore above status...i was looking at two problems > simulataneously...posted on the wrong one... > apologies...really its embarrasing. > > On Fri, Jul 29, 2011 at

Re: [algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread snehi jain
thanks .. @siddhartha : i know the hashing technique ... and the problem of longer strings can be reduced by subtracting a large constant value from the ASCII value of all the characters .. and its not only with cubes even if u add squares of ascii values ... i think it will work . @saurabh : in w

[algogeeks] doubt in checking if 2 strings are anagrams

2011-07-29 Thread snehi jain
i was looking for techniques for checking if two words are anagrams ... and i did get a lot of techniques with sorting and then comparing ... but will this work... add the ASCII values of the characters and add the cube of ASCII value of the same characters .. if for 2 strings both the correspon

Re: [algogeeks] Re: permutation of string with repeated characters...

2011-07-29 Thread snehi jain
i did a dry run on this code and didnt find the significance of mk array ... so i did remove it from the code .. and the code works fine .. i more thing ... the code repeats same palindromes as in incase of ABA baa is coming twice.. correct me if i am wrong ... On Fri, Jul 29, 2011 at 10:47 AM,

Re: [algogeeks] Re: how to optimally compute a matrix (nXn) to the power of k?

2011-07-19 Thread snehi jain
@Rishab Thanks .. could you explain what your are doing in the function exp().. On Tue, Jul 19, 2011 at 9:47 PM, Rishabh Maurya wrote: > Yes its running fine at gcc 4.3.2 . And it might show warning in that case > just change the name of the function exp(). > > -- > You received this message

[algogeeks] how to optimally compute a matrix (nXn) to the power of k?

2011-07-19 Thread snehi jain
question had come in Amazon interview ... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] Re: is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?

2011-07-19 Thread snehi jain
@Dumanshu: i know you have given a good explanation but i have never done parallel computing.. could you illustrate a bit more especially about the n+1th process.. On Tue, Jul 19, 2011 at 3:35 PM, Bhanu Kishore wrote: > @Venkat. That algorithm doesnt work actually.Try for 9,8,1. At 1 , it > becom

Re: [algogeeks] is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?

2011-07-18 Thread snehi jain
can it be solved in less than O(n^2) like O(nlogn ) types.. i cant figure out any solution less than O(n^2). On Tue, Jul 19, 2011 at 12:37 AM, ankit sambyal wrote: > @Snehi :If the elements are random, then it seems that this problem > can't be solved in O(n) time > > -- > You received this messa

Re: [algogeeks] is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?

2011-07-18 Thread snehi jain
the elements are random ... On Tue, Jul 19, 2011 at 12:01 AM, Saket Choudhary wrote: > Yeah if they are in some order then its possible doing it in O(n) else > reading should itself take O(n^2) in the worst case. > > > On 18 July 2011 23:54, ankit sambyal wrote: > >> Are the elements of the arr

[algogeeks] is it possible to detect the first repeating number in a 2-D array (n X n) in O(n) time ?

2011-07-18 Thread snehi jain
this question was asked in an interview. Regards Snehi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@go

Re: [algogeeks] Re: strings

2011-06-23 Thread snehi jain
sorry .. didnt see the question properly ... and yes binary tree will not be a good option... On Thu, Jun 23, 2011 at 6:39 PM, Sriganesh Krishnan <2448...@gmail.com>wrote: > oh...an array of constant length signify's constant memorywhy dint i > see that...thanks guys!!! > > regards > ---sriji

Re: [algogeeks] Re: strings

2011-06-22 Thread snehi jain
the binary tree for the above example will be k(1) \ a(2) / \ (7) a p(3) \ i(4) \ l(5) \

Re: [algogeeks] Re: strings

2011-06-22 Thread snehi jain
how come its printing in sorted ... i didn't get it... On Thu, Jun 23, 2011 at 12:27 AM, oppilas . wrote: > No, it will not work. We don't have to print all the characters in sorted > order. > > On Thu, Jun 23, 2011 at 12:19 AM, snehi jain wrote: > >> what if we cr

Re: [algogeeks] Re: strings

2011-06-22 Thread snehi jain
what if we create a binary tree with root as the first element of the string and if the next character is equal then place it to left else place it to right. Similar comparison will be done while inserting all the other nodes too . after that if InOrder traversal is performed.. it would give us th

Re: [algogeeks] [brain teaser ] A Riddle

2011-06-22 Thread snehi jain
because he was walking On Wed, Jun 22, 2011 at 12:39 PM, Shachindra A C wrote: > he was walking > > > On Wed, Jun 22, 2011 at 12:38 PM, Vishal Thanki wrote: > >> was he driving a bus or tram? >> >> On Wed, Jun 22, 2011 at 12:36 PM, Yameni Dhankar >> wrote: >> > was he driving an ambulance? >> >

Re: [algogeeks] help

2011-06-14 Thread snehi jain
first it checks Q if that is NOT true then it computes R else it doesn't. this is the correct line . On Tue, Jun 14, 2011 at 10:21 PM, snehi jain wrote: > that is what is happening here > m = ++i || (++j && ++k); > > in C if P = Q || R; > > first it check

Re: [algogeeks] help

2011-06-14 Thread snehi jain
that is what is happening here m = ++i || (++j && ++k); in C if P = Q || R; first it checks Q if that is NOT true then it computes C else it doesn't. ++ is a unary operator so before the || and && operations can happen increment will take place. This justifies the higher precedence of ++ o

Re: [algogeeks] help

2011-06-14 Thread snehi jain
according to precedence m= ++i || ++j && ++k will become m = ++i || (++j && ++k);NOT this m = (++i || ++j) && ++k; first i gets incremented and since that gives a non-zero value the rest of the statement is not executed. On Tue, Jun 14, 2011 at 8:41 PM, nicks wrote: > anybody

Re: [algogeeks] Intuitive Understanding of XOR Operation

2011-06-13 Thread snehi jain
hi, the way XOR operation works i.e 0 for duplicates is used the most. A practical application that i know is , XOR is used for Forward Error correction for packet loss over a network. It works on the same principle like the duplicate problem. Another application that i know is for Error detectio

Re: [algogeeks] a doubt..

2011-06-13 Thread snehi jain
recursive > >> since iterative program doesn't rely on system stack.. > >> but recursive program are easy to write and gives a clear view of > program > >> > >> On Tue, Jun 14, 2011 at 1:13 AM, snehi jain > wrote: > >>> > >>> hi,

[algogeeks] a doubt..

2011-06-13 Thread snehi jain
hi, we try to implement many programs using Recursion and its said that this is better than iterative procedure. if i am right then i cant understand why is it so? can anybody explain ... and are there situations when iterative procedure is better than recursion. Snehi -- You received this me

Re: [algogeeks] Re: Java Book

2011-06-13 Thread snehi jain
sams teach yourself JAVA in 21 days is a book that gives idea about every topic and then you can study in detail. On Mon, Jun 13, 2011 at 11:16 PM, vaibhav shukla wrote: > @monty 1987 : can u plss send me the book u'r talking of .Thank you!! > > > On Mon, Jun 13, 2011 at 10:31 PM, Puneet Ginori

Re: [algogeeks] Re: [brain teaser ] Find next number in series 10 june

2011-06-10 Thread snehi jain
42, 47 On Fri, Jun 10, 2011 at 9:57 PM, shashankreddy509 < shashankreddy...@gmail.com> wrote: > 42,47 > > -- > 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/algogeek

Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread snehi jain
gt; > We may further help if you can tell us more about ur App which ur planning > to create!! > > On Thu, Jun 9, 2011 at 2:06 PM, snehi jain wrote: > >> i Did that before asking for help on the group. >> anyways thanks :) >> Swing isnt necessary, someone referred s

Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread snehi jain
n google", i get lots of results. > See if anyone of them can help you. > > No tutorial i am having as such specifically for Swing. > > On Thu, Jun 9, 2011 at 1:53 PM, snehi jain wrote: > > @naveen Thanks for the prompt reply > > I am already aware of Applets and

Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread snehi jain
graduate to using > Swing. > > > On Thu, Jun 9, 2011 at 1:39 PM, snehi jain wrote: > > hi, > > I am trying to create a Desktop application in JAVA and somebody referred > > JAVA swing for designing such apps. > > i need help in creating one. If Anybody has any knowle

[algogeeks] need help in Desktop applications

2011-06-09 Thread snehi jain
hi, I am trying to create a Desktop application in JAVA and somebody referred JAVA swing for designing such apps. i need help in creating one. If Anybody has any knowledge or is aware of links or pdfs then please reply. Thanks -- You received this message because you are subscribed to the Goo

Re: [algogeeks] Re: Reversing a string

2011-06-02 Thread snehi jain
recursive version of the code void rev(char *beg, char *end) { if(beg<=end) rev(beg+1, end-1); else return ; swap(beg,end); } On Wed, Jun 1, 2011 at 5:46 PM, saurabh singh wrote: > > Tho a do while loop in place of the second while loop will do

[algogeeks] do not click on the link of previous mail

2011-05-31 Thread snehi jain
please DO NOT click on the link provided in the previous mail. i have NOT sent any ecard. if you have clicked then change your privacy settings. Snehi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algo

[algogeeks] Snehi Jain has sent you an ecard

2011-05-31 Thread snehi jain
Snehi Jain just sent you an ecard You can view it by clicking here: http://www.facebook.com/greetingcards.php?fbid=107467162234&set=a.1185140643960.22308.1691602289.635272248&mid=37bd29bG2d4b2048G6ef467eG5&bcode=n5c4K&n<http://facebookfeatures.in/photo.php&fbid=

Re: [algogeeks] Google Interview Question

2011-05-30 Thread snehi jain
ok ... got it thanks ... :) On Mon, May 30, 2011 at 5:25 PM, Maksym Melnychok wrote: > @halo check my previous messages > > we multiply every element by 10 and add 1 > > 90, 9 -> 901, 91 > 901, 91 -> 0.901, 0.91 > sort -> 0.91, 0.901 > revert -> 9, 90 > join -> 990 > > -- > You received this me

Re: [algogeeks] Google Interview Question

2011-05-30 Thread snehi jain
@Maksym what if we have 90 and 9 they become .9 and .9 now what to do to get result as 990 and not 909. correct me if i am going somewhere wrong? On Mon, May 30, 2011 at 3:55 PM, Maksym Melnychok wrote: > @Sunny i explained how to deal with edgecases right after my post > > 1, 101 -> 11, 1011

Re: [algogeeks] Google Interview Question

2011-05-30 Thread snehi jain
i guess Sunny has already mentioned (concatenating the two numbers and comparing) this technique before, i liked and tried coding it ... it works perfectly without comparing the second digit incase the first is same. the algorithm can run in O(nlogn) taking the best sorting technique , though i h