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

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

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

2010-10-25 Thread ankur aggarwal
For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > S.Nishaanth, > Computer Science and engineering, > IIT Madras. > > -- > You received this message because you are subscribed to the Google Groups

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

2010-10-02 Thread ankur aggarwal
email to > algogeeks+unsubscr...@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

Re: [algogeeks] Help required

2010-09-22 Thread ankur aggarwal
se 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, visit this group at &g

Re: [algogeeks] Yahoo Question

2010-09-15 Thread ankur aggarwal
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, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- With Regards

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

2010-09-14 Thread ankur aggarwal
; > ///O(N^2) solution Does solution exits > in O(n) or (nlogn)..? reply me sum1 git dis.. > //i will post analysis of dsi program later i m solving usig OOPS > (Java) to represnt everything as object > //right me if i m wrong or hw we can improv

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

2010-08-03 Thread ankur aggarwal
is 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, v

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

2010-08-02 Thread ankur aggarwal
quoted text - > > -- > 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] 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 al

Re: [algogeeks] a google question

2010-07-21 Thread ankur aggarwal
oglegroups.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 grou

Re: [algogeeks] XOR list

2010-07-16 Thread ankur aggarwal
" 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, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > --

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 wrote: > @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 Fr

Re: [algogeeks] online movies streaming

2010-07-15 Thread ankur aggarwal
thm 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, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > >

Re: [algogeeks] Re: AMAZON Interview Question

2010-07-15 Thread 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 > . > F

Re: [algogeeks] 32 comparisons only

2010-07-12 Thread ankur aggarwal
oup 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 fr

Re: [algogeeks] Minimum Window String

2010-07-12 Thread ankur aggarwal
ibe from this group, send email to > algogeeks+unsubscr...@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 are subscribed to the Goo

Re: [algogeeks] xoring

2010-07-12 Thread ankur aggarwal
..@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@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 beca

Re: [algogeeks] Re: amazon:-

2010-07-12 Thread ankur aggarwal
.@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@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] Re: Difference b/w two elements in a array

2010-07-12 Thread ankur aggarwal
be from 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 Gro

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

2010-06-30 Thread ankur aggarwal
ogle 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, visit this group at > http://groups.google.com/group/a

Re: [algogeeks] crazy

2010-06-29 Thread ankur aggarwal
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, visit this group at > http://groups.go

[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 "Algor

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

Re: [algogeeks] Re: Algorithm intensive Please solve

2010-02-16 Thread ankur aggarwal
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, visit this group

Re: [algogeeks] Re: sort the LL

2010-01-14 Thread ankur aggarwal
roups.com. > To unsubscribe from 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 Aggarwal -- You received this message because you are subscr

[algogeeks] ant problem

2009-11-03 Thread ankur aggarwal
An ant stays at one corner of a cube. It can go only along the side with equal probability, and taking one minute to get to another corner. What is the expect minutes for the ant coming back to the original position? -- You received this message because you are subscribed to the Google Groups "

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 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 > foreach(bj in B) >

[algogeeks] aai + bj + ck =0

2009-10-30 Thread ankur aggarwal
Given 3 randomly filled array of size N ( say A , B and C ).give Algorithm to verify if there exists a triplet such that ai + bj + ck =0 where 0http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---

[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 wrote: > 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... > > > > > --~--~-~--~~~---~--~~ You r

[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 wrote: > > Case 1: We have the Big Picture to verify the result > solution: 1.first we will identi

[algogeeks] Re: ROTATE

2009-10-14 Thread ankur aggarwal
gt; So temp will contain >>> >>> On Tue, Oct 13, 2009 at 12:07 AM, GauravNITW wrote: >>> >>>> >>>> How abt this..? >>>> >>>> for(i=0;i>>> { >>>>res=no&1U; >>>>no=no>>1; >

[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] 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] Re: ROTATE

2009-10-14 Thread ankur aggarwal
: >> >>> >>> How abt this..? >>> >>> for(i=0;i>> { >>>res=no&1U; >>>no=no>>1; >>> if(res==1) >>> no=no|32768U; >>>else >>> no=no|0U; >>> } >>> pri

[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

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

[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

[algogeeks] Re: optimum algo for second largest

2009-10-12 Thread ankur aggarwal
@shishir can u give the ds how would u save the history part ("save the data that was rejected by the highest element in order to get the 2nd highest") extra space will b required.. :( On Mon, Oct 12, 2009 at 3:15 AM, Shishir Mittal <1987.shis...@gmail.com>wrote: > It has been discussed here > h

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

[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 wrote: > > > *...@manisha >> " one traversal for each of the lists" >> * >> > &qu

[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] 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] 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 n

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

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

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

[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] 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 wrote: > LOL search for dominance in graph. > > 2009/10/7 ankur aggarwal > > Given a graph.. >> >> Find the minimum number of coloring (Marking) required to node such that >>

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

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

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

[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] 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] 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 T

[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! (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) possibiliti

[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 wrote: > edit distance.. > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send

[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+unsubsc

[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 wrote: > > yes it is different. > > Coin Denomination Problem [http://haroonsaeed.wordpress.com/2006/06/06/ > coin-denomination-problem/

[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 wrote: > > Is it different from classic Coin Denomination problem? > > _dufus > > On Sep 19, 11:20 pm, eSKay

[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 if we input any data > 500 and < 1000 then it will give 500+ number of 100 and also if it is in 1000 or 2000 then 100*5 + 500 +1000( number of thousand accordingly ) On Sat, Sep 19, 2009 at 11:50 PM, eSKay wrote: > > for example: if I draw 2000, what I get is > 1000+500+100+100+100+1

[algogeeks] Re: what will happen in the village

2009-09-19 Thread ankur aggarwal
t; then the man WOULD BE eaten. > if n is even then man WONT BE eaten. > > For a more elaborate explanation kindly refer to > http://quantfinanceinterviews.com/resources/sample1.pdf > > _dufus > > > On Sep 14, 2:16 pm, ankur aggarwal wrote: > > @dufus > > pl

[algogeeks] function problem

2009-09-17 Thread ankur aggarwal
5. void foo1() { if(Ahttp://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---

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

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

[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: what will happen in the village

2009-09-14 Thread ankur aggarwal
e. When the > > others fall asleep, he chows down. > > > > Dave > > > > On Sep 13, 7:24 am, jaspreet singh > > wrote: > > > > > the demons share the sleeping man amongst themselves.and hence > all > > > fall asleep a

[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 wrote: > The man lives forever... sleeps forever actually > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to

[algogeeks] Re: addition without using arithmetic operators

2009-09-12 Thread ankur aggarwal
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 is a after the assignment address of ptr[c] will be ptr +c*sizeof(type) if the type is char then it equals a+c*1=a+c value of ptr is stored as a hexadecimal number so the us

[algogeeks] Re: addition without using arithmetic operators

2009-09-12 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 wrote: > 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 is

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

2009-09-12 Thread ankur aggarwal
2] can be done in O(n) time. > http://lyle.smu.edu/~saad/courses/cse3358/ps5/problemset5sol.pdf<http://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,

[algogeeks] Re: find triangle in a graph

2009-09-11 Thread ankur aggarwal
---- > *From:* ankur aggarwal > *To:* "i...@mca_2007" ; > 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 in a graph Given

[algogeeks] Re: addition without using arithmetic operators

2009-09-11 Thread ankur aggarwal
@all int main() { int a,b; cin>>a>>b; char *ptr = (char *) a; char *ptr2 = &ptr[b]; cout<< (int) ptr2

[algogeeks] Re: find minimum number of races

2009-09-11 Thread ankur aggarwal
7 On Fri, Sep 11, 2009 at 8:14 PM, Dave wrote: > > Answered recently: see > http://groups.google.com/group/algogeeks/msg/077bdb6a282a1184 > > Dave > > On Sep 11, 9:32 am, dinesh bansal wrote: > > Hi All, > > > > I got a question: > > I have 25 horses and I need to find the 1st, 2nd and 3rd fast

[algogeeks] crazy man in the airplane

2009-09-10 Thread ankur aggarwal
crazy man in the airplane A line of 100 airline passengers is waiting to board a plane. they each hold a ticket to one of the 100 seats on that flight. (for convenience, let's say that the nth passenger in line has a ticket for the seat number n.) Unfortunately, the first person in line is crazy,

[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 > ) > --~--~-~--~~~---~--~~ Yo

[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
> 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 wrote: > > for 1st > > > > use hare and tortoise algo to fi

[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@googlegr

[algogeeks] Re: random number...

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

[algogeeks] Re: n balls having k colors

2009-09-08 Thread ankur aggarwal
code[k] = {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 > *To:* lets-talk-g...@googlegroups.com; algogeeks@

[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 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 numbers with a uniform d

[algogeeks] Re: linked list questions

2009-09-08 Thread ankur aggarwal
s, 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 wrote: > > for 1st > &

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

[algogeeks] Re: linked list questions

2009-09-08 Thread ankur aggarwal
ext = q; } for(p = original; p != null; p = p->next->next) p->next->random = p->random->next; for( q =original->next,r = original->next,p = original; p != null; p = p->next,q=q->next) { p->next = p->next->next; q->next = q->next->next; } r

[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) p

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
int, 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 aggarwal wrote: > > > > > Given a random

[algogeeks] Re: linked list questions

2009-09-08 Thread ankur aggarwal
@bharat your statement is not clear.. On Tue, Sep 8, 2009 at 11:51 AM, Bharath wrote: > > Slightly modifying first question. > > Check whether a string is palindrome in single pass. > > Meaning an online algorithm is required, i.e. it must be able to read > one character at a time from a stream

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
t; 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 aggarwal wrote: > > > > > Given a random number generator that generates numbers in the range 1 > to > > > 5,

[algogeeks] Re: random number...

2009-09-08 Thread ankur aggarwal
@dave * *On Tue, Sep 8, 2009 at 7:27 AM, Dave 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( U1 > 2 )//* pl

[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: 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 wrote: > Given a random number generator that generates numbers in the range 1 to > 5, how can u cr

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

2009-09-07 Thread ankur aggarwal
so far. > > > > A good discussion on this problem and different solutions can be found > > at > > > http://www.akalin.cx/2007/11/28/finding-the-longest-palindromic-substring-in-linear-time/ > > > > _dufus > > > > > > On Aug 31, 6:01 pm, ank

[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@g

[algogeeks] stock market

2009-09-07 Thread ankur aggarwal
1.Write a function to smooth out stock fluctuations. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this gr

[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: 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 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 of (j-k)

[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

  1   2   >