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

2011-06-10 Thread ankur aggarwal
42, 49 2011/6/10 • » νιρυℓ « • vipulmehta.1...@gmail.com 42, 47 just guessing according to the pattern. On Fri, Jun 10, 2011 at 1:37 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Find next number in series * * *** * * ** *What are the next two numbers in this sequence? 7, 14, 17,

Re: [algogeeks] Re: Smallest window of K[] in N[]. Best order solution

2010-10-25 Thread ankur aggarwal
to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal +91-7838289304 Software Engineer Slideshare Delhi INDIA. -- You received this message

Re: [algogeeks] ATM machine---Google Question

2010-10-02 Thread ankur aggarwal
...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal +91-7838289304 Software Engineer Slideshare Delhi INDIA. -- You received this message because you are subscribed

Re: [algogeeks] Help required

2010-09-22 Thread ankur aggarwal
. -- With Regards Ankur Aggarwal +91-7838289304 Software Engineer Slideshare 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 algoge...@googlegroups.com. To unsubscribe from this group, send email

Re: [algogeeks] Yahoo Question

2010-09-15 Thread ankur aggarwal
. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal +91-7838289304 Software Engineer Slideshare Delhi

Re: [algogeeks] RE:Google Interview Question-Snake and Ladder Design

2010-09-14 Thread ankur aggarwal
://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal +91-7838289304 Software Engineer Slideshare 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 algoge

Re: [algogeeks] sorting range of numbers in O(n)

2010-08-03 Thread ankur aggarwal
to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received

Re: [algogeeks] Re: number of BST's

2010-08-02 Thread ankur aggarwal
. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options

Re: [algogeeks] a google question

2010-07-21 Thread ankur aggarwal
://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks

Re: [algogeeks] a google question

2010-07-21 Thread ankur aggarwal
this ques was asked by google.. i* could find any gud soln than order n*n -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] XOR list

2010-07-16 Thread ankur aggarwal
, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal

Re: [algogeeks] XOR list

2010-07-16 Thread ankur aggarwal
read coremen excercise ques of linklist... u will understand... On Fri, Jul 16, 2010 at 1:13 PM, ankur aggarwal ankur.mast@gmail.comwrote: @thread_creator do u really need a code... try understanding the logic.. coding is not tough.. i have a code.. i can mail u if u wanaa On Fri

Re: [algogeeks] Re: AMAZON Interview Question

2010-07-15 Thread ankur aggarwal
...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received

Re: [algogeeks] online movies streaming

2010-07-15 Thread ankur aggarwal
to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You

Re: [algogeeks] Re: Difference b/w two elements in a array

2010-07-12 Thread ankur aggarwal
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com

Re: [algogeeks] Re: amazon:-

2010-07-12 Thread ankur aggarwal
this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group

Re: [algogeeks] xoring

2010-07-12 Thread ankur aggarwal
. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received this message because you

Re: [algogeeks] Minimum Window String

2010-07-12 Thread ankur aggarwal
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com

Re: [algogeeks] 32 comparisons only

2010-07-12 Thread ankur aggarwal
://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr

Re: [algogeeks] Re: sort 0's 1's and 2's

2010-06-30 Thread ankur aggarwal
email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal -- You

Re: [algogeeks] crazy

2010-06-29 Thread ankur aggarwal
. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options

[algogeeks] c++ and sql

2010-06-04 Thread ankur aggarwal
Write a C/C++ console application that connects to a MySQL server and prints the number of aborted connects using information provided by MySQL's global variables. -- With Regards Ankur Aggarwal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] You have 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.

2010-03-04 Thread ankur aggarwal
...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards Ankur Aggarwal Research internee Optical Zeitgeist

Re: [algogeeks] Re: Algorithm intensive Please solve

2010-02-16 Thread ankur aggarwal
%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Aggarwal Research internee Optical Zeitgeist Laboratory Institut National de la Recherche Scientifique (INRS) - ÉMT 800, de la Gauchetière Ouest, bureau 6900

Re: [algogeeks] Re: aai + bj + ck =0

2009-11-01 Thread ankur aggarwal
@daizi i think this will not be n^2. check it again .. On Sun, Nov 1, 2009 at 1:09 PM, daizi sheng daizish...@gmail.com wrote: with all arrays sorted firstly, if you enumerate ai, bj in ascedning order, ck will be sure in descending order. foreach(ai in A) ck = largest element in C

[algogeeks] aai + bj + ck =0

2009-10-30 Thread ankur aggarwal
Given 3 randomly filled array of size N ( say Aa1,a2..aN , Bb1,b2…bN and Cc1,c2..cN ).give Algorithm to verify if there exists a triplet such that ai + bj + ck =0 where 0I,j,k=N Time complexity of Your algorithm should be O(NlogN) and state space complexity of you’re algorithm .O(N^2) algorithm

[algogeeks] kth number of a large number of data

2009-10-19 Thread ankur aggarwal
If you have a large number of data which are stored on 100 distributed computers, unsorted, how can you compute the kth number of all the data? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

[algogeeks] Re: 100!

2009-10-18 Thread ankur aggarwal
yeh.. no shortcut.. On Thu, Oct 15, 2009 at 9:44 PM, harit agarwal agarwalha...@gmail.comwrote: no use of all these logics.u have 2 calculate whole value of 100! for summation... use link list to store final value...after ever product...

[algogeeks] Re: picture problem

2009-10-16 Thread ankur aggarwal
i think yeh 8 puzzle problem maine convert karke ho sakti hain we r not provided wid any info about the moves.. i define my move as in 8 puzzle problem On Thu, Oct 15, 2009 at 10:58 PM, Pawandeep bhatti.pawand...@gmail.comwrote: Case 1: We have the Big Picture to verify the result

[algogeeks] Re: ROTATE

2009-10-14 Thread ankur aggarwal
= (n x) | ( temp (32 -x)); On Mon, Oct 12, 2009 at 5:32 PM, ankur aggarwal ankur.mast@gmail.comwrote: *You are given a integer and you want to rotate the bits of the number by a value x. Consider the right rotation by x means the least significant x bits should go out

[algogeeks] picture problem

2009-10-14 Thread ankur aggarwal
A square picture is cut into 16 squares and they are shuffled. Write a program to rearrange the 16 squares to get the original big square. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] use putchar to print out an unsigned long in decimal

2009-10-14 Thread ankur aggarwal
1. Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] Re: ROTATE

2009-10-14 Thread ankur aggarwal
-x)); On Mon, Oct 12, 2009 at 5:32 PM, ankur aggarwal ankur.mast@gmail.comwrote: *You are given a integer and you want to rotate the bits of the number by a value x. Consider the right rotation by x means the least significant x bits should go out from left and take

[algogeeks] Re: optimum algo for second largest

2009-10-12 Thread ankur aggarwal
in that case it is ok.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to

[algogeeks] ROTATE

2009-10-12 Thread ankur aggarwal
*You are given a integer and you want to rotate the bits of the number by a value x. Consider the right rotation by x means the least significant x bits should go out from left and take the position of most significant x bits.* --~--~-~--~~~---~--~~ You received

[algogeeks] Re: ROTATE

2009-10-12 Thread ankur aggarwal
@raghav plz give an example wat r u trying 2 do. On Mon, Oct 12, 2009 at 8:41 PM, Raghavendra Sharma raghavendra.vel...@gmail.com wrote: temp = (0x (32 - x)) n; n = (n x) | ( temp (32 -x)); On Mon, Oct 12, 2009 at 5:32 PM, ankur aggarwal ankur.mast@gmail.comwrote: *You

[algogeeks] Re: Y shaped linklist

2009-10-11 Thread ankur aggarwal
*...@manisha one traversal for each of the lists * After* two traversals, *both pointers will surely meet at intersection point.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Re: Y shaped linklist

2009-10-11 Thread ankur aggarwal
*...@manisha one traversal for each of the lists * --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this

[algogeeks] Re: 100!

2009-10-11 Thread ankur aggarwal
@gautam i dont understand On Sun, Oct 11, 2009 at 6:59 PM, Prunthaban Kanthakumar pruntha...@gmail.com wrote: On Sun, Oct 11, 2009 at 6:40 PM, Gautham Muthuravichandran gautha...@gmail.com wrote: 9.. All the factorials above 5! is divisible by 9. Divisible by 9 does not mean exactly

[algogeeks] minimum number of comparisons

2009-10-11 Thread ankur aggarwal
Q1. Give steps to sort 5 numbers in minimum number of comparisons .Justify that number of comparisons are minimum. Extend your argument for *N*numbers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] gold bar

2009-10-11 Thread ankur aggarwal
You've got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker?

[algogeeks] Re: Y shaped linklist

2009-10-11 Thread ankur aggarwal
@manisha that is the ques.. there are many soln for 2 traversal like loop in the linklist. simple travesal n many more.. On Sun, Oct 11, 2009 at 1:20 PM, ankur aggarwal ankur.mast@gmail.comwrote: *...@manisha one traversal for each of the lists * After* two traversals, *both

[algogeeks] Re: 100!

2009-10-11 Thread ankur aggarwal
@gautam * find sum of all the digits in number-100!* now show wat is significance of 9 in this ques ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] sum of subsequence.

2009-10-09 Thread ankur aggarwal
2. Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. i) 3 2 7 10 should return 13 (sum of 3 and 10) ii) 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)

[algogeeks] Y shaped linklist

2009-10-09 Thread ankur aggarwal
How to find the intersection point in linked list with the following constraints 1) one traversal for each of the lists 2) should not find the LENGTH of the lists 3) can USE recursion It goes like this ... --~--~-~--~~~---~--~~ You received this message because you

[algogeeks] infinite memory

2009-10-09 Thread ankur aggarwal
How will you implement infinite memory(infinite strings) in finite space Propose some method... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] search your friend

2009-10-09 Thread ankur aggarwal
You are standing at a crossing from where there emerge four roads extending to infinity. Your friend is somewhere on one of the four roads. You do not know on which road he is and how far he is from you. You have to walk to your friend and the total distance traveled by you must be at most a

[algogeeks] Re: Y shaped linklist

2009-10-09 Thread ankur aggarwal
@sharad wat about space ?? extra space ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send

[algogeeks] Re: coloring (Marking)

2009-10-09 Thread ankur aggarwal
it is NP hard problem i suppose.. On Fri, Oct 9, 2009 at 4:20 PM, Miroslav Balaz gpsla...@googlemail.comwrote: LOL search for dominance in graph. 2009/10/7 ankur aggarwal ankur.mast@gmail.com Given a graph.. Find the minimum number of coloring (Marking) required to node

[algogeeks] Re: search your friend

2009-10-09 Thread ankur aggarwal
yes anil your approach is rite.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to

[algogeeks] balls and lines

2009-10-09 Thread ankur aggarwal
Given 13 balls, how would you arrange them in 9 lines, such that there are 4 balls in each line? You can assume that the lines are arranged in 2-D space and that a ball cannot be placed on top of another ball. Bonus: if you find that too easy, and have loads of time to kill, then how about

[algogeeks] add data members at runtime.

2009-10-07 Thread ankur aggarwal
Implement a c++ class such that it allows us to add data members at runtime. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To

[algogeeks] coloring (Marking)

2009-10-07 Thread ankur aggarwal
Given a graph.. Find the minimum number of coloring (Marking) required to node such that every node in the final graph is connected by at least one of the colored(marked) node. ex: AB AC BD BE CF sol: 2 nodes to be colored. i.e. Colouring C and B would suffice..

[algogeeks] Re: How many different permutations of a Rubik's cube are possible?

2009-10-04 Thread ankur aggarwal
The original (3×3×3) Rubik's Cube has eight corners and twelve edges. There are 8! http://en.wikipedia.org/wiki/Factorial (40,320) ways to arrange the corner cubes. Seven can be oriented independently, and the orientation of the eighth depends on the preceding seven, giving 37 (2,187)

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread ankur aggarwal
edit distance.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread ankur aggarwal
tries On Fri, Sep 25, 2009 at 11:30 PM, ankur aggarwal ankur.mast@gmail.comwrote: edit distance.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-20 Thread ankur aggarwal
@dufus i dont think becoz if u have to take 1000rs then we have 500 note and 100 rs note though we have 1000rs note. IT is in INDIA.. i dont know about other countries On 9/20/09, Dufus rahul.dev.si...@gmail.com wrote: Is it different from classic Coin Denomination problem? _dufus On Sep

[algogeeks] Re: What algorithm can be used to decide the denomination of notes in an ATM machine?

2009-09-20 Thread ankur aggarwal
i think there is no use of discussing this ques.. On Sun, Sep 20, 2009 at 2:25 PM, eSKay catchyouraak...@gmail.com wrote: yes it is different. Coin Denomination Problem [http://haroonsaeed.wordpress.com/2006/06/06/

[algogeeks] find words which satisfy some criteria

2009-09-17 Thread ankur aggarwal
All of you guys must have played a game in which a 2-D Matrix of characters is given. The goal to find words which satisfy some criteria (eg. Names of various countries etc...) The words can be present horizontally, vertically and diogonally both in forward and reverse order. This is a pretty

[algogeeks] function problem

2009-09-17 Thread ankur aggarwal
5. void foo1() { if(AB) Then {_/* */} else if(CD) then foo2() } How many time foo2() would get called given AB 25% of the times and CD 75% of the times and foo1() is called 5000 times --~--~-~--~~~---~--~~ You received this message because you are subscribed to

[algogeeks] Re: Z[n^2]={such that z belongs to X+Y

2009-09-15 Thread ankur aggarwal
*For each of the n*m sums add it to the heap (if it ain't full with k elements) or replace the root and heapify if the sum is lesser than the root.* how u can judge which is the next value to be added.. try your algo at array a 1 2 3 4 5 7 9 and array b 2 3 5 6 7

[algogeeks] Re: Citrix interview question

2009-09-15 Thread ankur aggarwal
compiler dependent as simple as that.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email

[algogeeks] Re: what will happen in the village

2009-09-14 Thread ankur aggarwal
at 5:42 PM, ankur aggarwal ankur.mast@gmail.comwrote: nothing happens... On Sun, Sep 13, 2009 at 5:32 PM, Vikram Sridar vikramsridar...@gmail.comwrote: The man lives forever... sleeps forever actually- Hide quoted text - - Show quoted text

[algogeeks] Re: addition without using arithmetic operators

2009-09-13 Thread ankur aggarwal
this soln may fail on -ve number i havenot tried .. but the basic funda is this .. On Sun, Sep 13, 2009 at 11:23 AM, ankur aggarwal ankur.mast@gmail.comwrote: size of char is 1 byte but that of int is 4 If i use int then output for a,b will be a+4*b in the program the value of ptr

[algogeeks] Re: what will happen in the village

2009-09-13 Thread ankur aggarwal
nothing happens... On Sun, Sep 13, 2009 at 5:32 PM, Vikram Sridar vikramsridar...@gmail.comwrote: The man lives forever... sleeps forever actually --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: Z[n^2]={such that z belongs to X+Y

2009-09-12 Thread ankur aggarwal
EXTRACT_MIN for Z[n^2] can be done in O(n) time. http://lyle.smu.edu/~saad/courses/cse3358/ps5/problemset5sol.pdfhttp://lyle.smu.edu/%7Esaad/courses/cse3358/ps5/problemset5sol.pdf Then using it we can find the kth smallest element in O(nk) time. _dufus On Sep 4, 10:03 pm, ankur aggarwal

[algogeeks] Re: find minimum number of races

2009-09-11 Thread ankur aggarwal
7 On Fri, Sep 11, 2009 at 8:14 PM, Dave dave_and_da...@juno.com wrote: Answered recently: see http://groups.google.com/group/algogeeks/msg/077bdb6a282a1184 Dave On Sep 11, 9:32 am, dinesh bansal bansal...@gmail.com wrote: Hi All, I got a question: I have 25 horses and I need to

[algogeeks] Re: addition without using arithmetic operators

2009-09-11 Thread ankur aggarwal
@all int main() { int a,b; cinab; char *ptr = (char *) a; char *ptr2 = ptr[b]; cout (int) ptr2 endl; return 0; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: find triangle in a graph

2009-09-11 Thread ankur aggarwal
? -- *From:* ankur aggarwal ankur.mast@gmail.com *To:* i...@mca_2007 iit_rmca_2...@googlegroups.com; lets-talk-g...@googlegroups.com; algogeeks@googlegroups.com *Sent:* Sunday, 6 September, 2009 2:58:40 PM *Subject:* [algogeeks] find triangle in a graph google question : find triangle

[algogeeks] Re: [Let's Talk] Re: random number...

2009-09-09 Thread ankur aggarwal
http://stackoverflow.com/questions/137783/given-a-function-which-produces-a-random-integer-in-the-range-1-to-5-write-a-fun and wat about it return (((rand_5()+rand_5()+rand_5()+rand_5()+rand_5()+rand_5()+rand_5())-7)%7 + 1 ) --~--~-~--~~~---~--~~ You

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
@dave * *On Tue, Sep 8, 2009 at 7:27 AM, Dave dave_and_da...@juno.com wrote: Use the rejection technique, something like this: do { do U1 = random_1_to_5(); while( U1 == 5 ); // At this point, U1 is a uniform integer in the range 1 to 4. U2 = random_1_to_5(); * if(

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
in the range 1 to 4. U2 = random_1_to_5(); if( U1 2 ) U2 += 5;} while( U2 7 ); // At this point, U2 is a uniform random integer in the range 1 to 7. It takes on average 45/14 1_to_5 random numbers to make a 1_to_7 random number. Dave On Sep 7, 10:56 am, ankur

[algogeeks] Re: linked list questions

2009-09-08 Thread ankur aggarwal
for 1st use hare and tortoise algo to find the mid point of the linklist ... and reverse the other end like a-b--c-d-v-u a-b--c-d-v-u pointer 1 will point to a and other pointer will point to u then it is done .. u can check.. 2nd for(p = original; p != null; p = p-next-next)

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
@karthik but look at the prob part.. it seems ok 2 me.. it is random generator u cannot guarntee which number is going 2 come.. On Tue, Sep 8, 2009 at 7:34 PM, Karthik Singaram Lakshmanan karthiksinga...@gmail.com wrote: The rejection technique may never halt...(with an infinitesimally

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
@dave plz quote the name of the person u r taking / pointing.. On Tue, Sep 8, 2009 at 8:11 PM, Dave dave_and_da...@juno.com wrote: Your comment is moot, since if any random number generator returns the same number forever, you are not going to be able to use it to generate other random

[algogeeks] Re: n balls having k colors

2009-09-08 Thread ankur aggarwal
] = {0,2,..,k-1} foreach (permutation from all possible-permuations of code[]) sort balls[] on the basis of code[color_tag] print balls[] -- *From:* ankur aggarwal ankur.mast@gmail.com *To:* lets-talk-g...@googlegroups.com; algogeeks@googlegroups.com

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
On Tue, Sep 8, 2009 at 9:04 PM, ankur aggarwal ankur.mast@gmail.comwrote: @dave plz quote the name of the person u r *talking* / pointing.. On Tue, Sep 8, 2009 at 8:11 PM, Dave dave_and_da...@juno.com wrote: Your comment is moot, since if any random number generator returns the same

[algogeeks] Re: linked list questions

2009-09-08 Thread ankur aggarwal
passes, can we do it in single pass on a list? One method i can think of is, hashing character to its postion and check for the sum. abccba 123456 a: 1+6=7 b: 2+5=7 c: 3+4=7 On Sep 8, 5:33 pm, ankur aggarwal ankur.mast@gmail.com wrote: for 1st use hare and tortoise algo to find

[algogeeks] Re: n balls having k colors

2009-09-08 Thread ankur aggarwal
extra space is sol to this 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

[algogeeks] Re: linked list questions

2009-09-08 Thread ankur aggarwal
@bharath how will u recognize which a to compare to which a or apply on malayalam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] phone numbers.

2009-09-07 Thread ankur aggarwal
3.You have 50,000 html files, some of which contain phone numbers. How would you create a list of all the files which contain phone numbers? Solutions should be optimal --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[algogeeks] Re: find triangle in a graph

2009-09-07 Thread ankur aggarwal
* * * @kunzmilan * * * * What do you mean by polynomial of the graph ? * * * --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Re: Find longest palindrom in a give n string in O(N)

2009-09-07 Thread ankur aggarwal
/2007/11/28/finding-the-longest-palindromic-substring-in-linear-time/ _dufus On Aug 31, 6:01 pm, ankur aggarwal ankur.mast@gmail.com wrote: @abhijeet dryrun on this abbaabba On Mon, Aug 31, 2009 at 5:45 PM, Abhijeet Kumar abhijeet.k.s...@gmail.comwrote: u can push

[algogeeks] Re: random number...

2009-09-07 Thread ankur aggarwal
I KNow a sol for given a rand_5() function which generates *0* to 5 and we have to find rand_7() for *0* to 7 could not think about it... On Mon, Sep 7, 2009 at 9:26 PM, ankur aggarwal ankur.mast@gmail.comwrote: Given a random number generator that generates numbers in the range 1 to 5

[algogeeks] random number...

2009-09-07 Thread ankur aggarwal
Given a random number generator that generates numbers in the range 1 to 5, how can u create a random number generator to generate numbers in the range 1 to 7. (remember that the generated random numbers should follow a uniform distribution in the corresponding range)

[algogeeks] Re: Z[n^2]={such that z belongs to X+Y

2009-09-06 Thread ankur aggarwal
@dufus wat is your complexity ?? On Sat, Sep 5, 2009 at 8:17 PM, Dufus rahul.dev.si...@gmail.com wrote: In that case I would sacrifice a little bit on time complexity and instead of storing I would recompute the values. _dufus On Sep 5, 5:10 pm, ankur aggarwal ankur.mast@gmail.com

[algogeeks] find triangle in a graph

2009-09-06 Thread ankur aggarwal
google question : find triangle in a graph Given an undirected graph, design a O(V+E) algo to detect whether there is a triangle in the graph ot not. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] n balls having k colors

2009-09-06 Thread ankur aggarwal
You have N balls having one of K colors. Arrange them into groups of same colors. e.g. RRGRG can be arranged as RRRGG (Answer) GGRRR --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

[algogeeks] Re: Largest span of Increasing Pair in an array

2009-09-06 Thread ankur aggarwal
o(n) is the best sol known to me.. On Sun, Sep 6, 2009 at 1:54 PM, Pramod Negi negi.1...@gmail.com wrote: i guess sorting will do the work. any other constraint?? On Sun, Sep 6, 2009 at 9:52 AM, p0r$h 1987.shis...@gmail.com wrote: Given an array of integers A[N], find the maximum value

[algogeeks] Re: 1 Trillion integers on hard disk, find the smallest 1 million of them

2009-09-05 Thread ankur aggarwal
@vishwanathan i think this is same as external sort.. this is the same i was thinking.. external sort in *mark allen wiese* On Fri, Sep 4, 2009 at 8:59 PM, viswanath ramakrishnan srviswanat...@gmail.com wrote: Q.3: Given a set of 1 Trillion integers on hard disk, find the smallest 1

[algogeeks] Re: Z[n^2]={such that z belongs to X+Y

2009-09-05 Thread ankur aggarwal
*find the posiible sums using brute force.then apply this algo this is the main problem .. how to do efficiently ?? * --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] Re: Z[n^2]={such that z belongs to X+Y

2009-09-05 Thread ankur aggarwal
://lyle.smu.edu/%7Esaad/courses/cse3358/ps5/problemset5sol.pdf Then using it we can find the kth smallest element in O(nk) time. _dufus On Sep 4, 10:03 pm, ankur aggarwal ankur.mast@gmail.com wrote: Find nth smallest inO(n) Given two arrays of length n in sorted order X[n] Y[n]. Now make

[algogeeks] Re: 1 Trillion integers on hard disk, find the smallest 1 million of them

2009-09-05 Thread ankur aggarwal
@all i got a sol this from my friend .. Sort chunks of 1Million numbers. There will be 10^6 (1-million) set of 1 million numbers in 1 trillion numbers. Now initialize a min-heap of size 1 million with first element of each set. Keep removing the minimum element (1 million times) and replacing

[algogeeks] Re: 1 Trillion integers on hard disk, find the smallest 1 million of them

2009-09-05 Thread ankur aggarwal
@nayan u can stop reading .. but i still does not get the sol ... On Sat, Sep 5, 2009 at 7:35 PM, Nayn nayanish.hi...@gmail.com wrote: Guys, this is going in totally different direction. Solution given by Shishir (using Max-Heap) works perfectly. If anybody has any better solution please

[algogeeks] Z[n^2]={such that z belongs to X+Y

2009-09-04 Thread ankur aggarwal
Find nth smallest inO(n) Given two arrays of length n in sorted order X[n] Y[n]. Now make another array Z[n^2]={such that z belongs to X+Y}. AS all possible sum of x+y is there in Z. You have to give the nth smallest no of Z in O(n) time. Space complexity : No bound on it. But try to optimize it

[algogeeks] divide two extremely large numbers

2009-09-04 Thread ankur aggarwal
Write an algorithm two divide two extremely large numbers, which cannot be stored in an int, long int, float, double etc. Find the remainder and quotient . --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: adobe interview question

2009-09-02 Thread ankur aggarwal
1 or 2 depends if diagonal sqaure are considered to be same as adjacent On Wed, Sep 2, 2009 at 8:28 PM, Nagendra Kumar nagendra@gmail.comwrote: Can anyone recheck and rephrase the question becuase i think it would be always '0' On Wed, Sep 2, 2009 at 10:40 AM,

[algogeeks] Re: Find longest palindrom in a give n string in O(N)

2009-09-01 Thread ankur aggarwal
@nitin wat is the complexity ?? can it be done linear ?? On Mon, Aug 31, 2009 at 6:07 PM, nitin mathur nitinkumar.mat...@gmail.comwrote: We can use the concept of longest common substring. For that use following steps: 1) take the original string say A. 2) make a copy of it say B. 3)

[algogeeks] 1 Trillion integers on hard disk, find the smallest 1 million of them

2009-09-01 Thread ankur aggarwal
* Q.3: Given a set of 1 Trillion integers on hard disk, find the smallest 1 million of them. You can fit at most 1 million integers in memory at a time. State the fastest solution you can think of. --~--~-~--~~~---~--~~ You received this message because you are

[algogeeks] Re: Median Finding algorithms.

2009-09-01 Thread ankur aggarwal
On Tue, Sep 1, 2009 at 6:04 PM, ankur aggarwal ankur.mast@gmail.comwrote: @shishir i could *not *understand cann u give an example.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group

  1   2   >