Re: [algogeeks] program

2012-07-26 Thread Ali Innovative
thanks:) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this

Re: [algogeeks] program

2012-07-26 Thread Hassan Monfared
+ Manish Patidar On Thu, Jul 26, 2012 at 10:14 PM, Manish Patidar wrote: > 20 > Thank you, > Have a great day !! > > >* With Regards, > * > * > Manish Patidar.* > > > > On Thu, Jul 26, 2012 at 11:11 PM, payal gupta wrote: > >> ans.20 >> >> >> On Thu, Jul 26,

Re: [algogeeks] program

2012-07-26 Thread Manish Patidar
20 Thank you, Have a great day !! * With Regards, * * Manish Patidar.* On Thu, Jul 26, 2012 at 11:11 PM, payal gupta wrote: > ans.20 > > > On Thu, Jul 26, 2012 at 11:09 PM, Ali Ahmad Ansari < > ali.ahamad.ans...@gmail.com> wrote: > >> Given a number N, gene

Re: [algogeeks] program

2012-07-26 Thread payal gupta
ans.20 On Thu, Jul 26, 2012 at 11:09 PM, Ali Ahmad Ansari < ali.ahamad.ans...@gmail.com> wrote: > Given a number N, generate a sequence S such that > S[ 0 ] = N > S[ i+1 ] = (3 * S[ i ] + 1) / 2 if S[ i ] is odd, > = S[ i ] / 2, if S[ i ] is even, > till you reach 1. > For example for N = 5, the

[algogeeks] program

2012-07-26 Thread Ali Ahmad Ansari
Given a number N, generate a sequence S such that S[ 0 ] = N S[ i+1 ] = (3 * S[ i ] + 1) / 2 if S[ i ] is odd, = S[ i ] / 2, if S[ i ] is even, till you reach 1. For example for N = 5, the sequence is 5, 8, 4, 2, 1 Given two numbers 20 and 35, generate the sequence S for A and B, and find the numbe

Re: [algogeeks] program to convert roman to integer.........

2011-11-06 Thread Vandana Bachani
/Convert roman to decimal #include int convert(char *s, int len) { int i = 0, d = 0, prev = 0; for(;i < len; i++) { switch(*(s+i)) { case 'i': d += 1; break; case 'v': if(i!=0 && *(s+prev) == 'i') { d = d + 5 - 2; } else

[algogeeks] program to convert roman to integer.........

2011-11-06 Thread rahul sharma
i.p: v o/p 5 i/p ix o/p:9 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options

Re: [algogeeks] program

2011-09-14 Thread sagar pareek
Use hashing like counting sort... On Wed, Sep 14, 2011 at 11:20 AM, raj wrote: > program to find the top 3 repeating number from the given array > eg > You r given an array and u have to find out the top 3 repeated > numbers. > for ex: GAURAV[]={20,8,3,7,8,9,20,6,4,6,20,8,20} > so the output wi

Re: [algogeeks] program

2011-09-14 Thread abhinav gupta
Create a structure with num,count(of num) and link parse the array and create nodes (nodes are created with id=num). when the no of nodes == 3 print the nodes data and count. On Wed, Sep 14, 2011 at 5:13 PM, parag khanna wrote: > > find the frequencies of each alphabet ... n store it in an array

Re: [algogeeks] program

2011-09-14 Thread parag khanna
find the frequencies of each alphabet ... n store it in an array corressponding to the ascii value of the alphabet as a index of array ... n store its count ... then sort the array in decreasing order ... and return the top 3 index value of the array in integer form -- > Parag Khanna > B.tech

Re: [algogeeks] program

2011-09-14 Thread sukran dhawan
heap construction ... On Wed, Sep 14, 2011 at 4:44 PM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > with space O(n) and time O(n), we can trace the whole array and maintain > the freq of each number and by one more trace with using 3 variables , > we can find top 3 > >

Re: [algogeeks] program

2011-09-14 Thread bharatkumar bagana
with space O(n) and time O(n), we can trace the whole array and maintain the freq of each number and by one more trace with using 3 variables , we can find top 3 On Wed, Sep 14, 2011 at 11:20 AM, raj wrote: > program to find the top 3 repeating number from the given array > eg > You

[algogeeks] program

2011-09-13 Thread raj
program to find the top 3 repeating number from the given array eg You r given an array and u have to find out the top 3 repeated numbers. for ex: GAURAV[]={20,8,3,7,8,9,20,6,4,6,20,8,20} so the output will be: 20 is repeated 4 times 8 is repeated 3 times 6 is repeated 2 times. -- You received t

Re: [algogeeks] program puzzle

2011-08-15 Thread Anil Arya
http://geeksforgeeks.org/?p=7150 that will clear you very well.i'm sure... On Mon, Aug 15, 2011 at 4:48 PM, programming love < love.for.programm...@gmail.com> wrote: > write a program to reverse the words in a give string. > also state the time complexity of the algo. > > if the string is "i

Re: [algogeeks] program puzzle

2011-08-15 Thread Anil Arya
First reverse the senetence word by word and then reverse the whole stringthat will be easier On Mon, Aug 15, 2011 at 4:48 PM, programming love < love.for.programm...@gmail.com> wrote: > write a program to reverse the words in a give string. > also state the time complexity of the algo. >

Re: [algogeeks] program puzzle

2011-08-15 Thread priya ramesh
@gopi: Each word is being accessed thrice. 1. reverse string 2. set pointers to beginning n end of string 3. reverse the word. If this is the came is the complexity O(n)?? It's a very good algo nevertheless :) On Mon, Aug 15, 2011 at 9:16 PM, *$* wrote: > method 1: > algo: > step 1 :reverse

Re: [algogeeks] program puzzle

2011-08-15 Thread *$*
method 1: algo: step 1 :reverse entire string .. (letter by letter) step 2: take two pointers ... keep first pointer at the starting of the word ... keep incrementing the second pointer , till space hits.. then , swap first pointer and second pointere data , by incrementing first pointer , and decr

Re: [algogeeks] program puzzle

2011-08-15 Thread siddharth srivastava
On 15 August 2011 16:48, programming love wrote: > write a program to reverse the words in a give string. > also state the time complexity of the algo. > It has already been discussed on the list a few days ago > > if the string is "i am a programmer" > the output should be "programmer a am i"

Re: [algogeeks] program puzzle

2011-08-15 Thread Dipankar Patro
@ MeHdi : Please read the problem properly yaar. You are just reversing the string by characters, not by words. On 15 August 2011 20:34, MeHdi KaZemI wrote: > string str = "i am a programmer" > for(int i = 0; i < str.size()/2; i ++) > swap(str[i], str[str.size()-i-1]); > time complexity O(n

Re: [algogeeks] program puzzle

2011-08-15 Thread MeHdi KaZemI
string str = "i am a programmer" for(int i = 0; i < str.size()/2; i ++) swap(str[i], str[str.size()-i-1]); time complexity O(n) On Mon, Aug 15, 2011 at 6:39 PM, sukran dhawan wrote: > reverse(string,n) // do it in place > > > p = str; > for(i=0;i { > if(str[i] == '\0' || str[i] == ' ')

Re: [algogeeks] program puzzle

2011-08-15 Thread sukran dhawan
reverse(string,n) // do it in place p = str; for(i=0;i wrote: > write a program to reverse the words in a give string. > also state the time complexity of the algo. > > if the string is "i am a programmer" > the output should be "programmer a am i" > > -- > You received this message because you

[algogeeks] program puzzle

2011-08-15 Thread programming love
write a program to reverse the words in a give string. also state the time complexity of the algo. if the string is "i am a programmer" the output should be "programmer a am i" -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this

[algogeeks] program to find max and min element in an array using recursion...

2011-08-01 Thread Indrajeet Khater
can u pls convert this algorithm into an executable code in c++ which can find the max and min element of an array in recursive method using divide and conquer strategy... int a[N]; // array int maxmin (A[]) { Split A into two parts: A1, A2; (max1,min1) = maxmin(A1); (max2,min2) = maxmin

[algogeeks] Program & System Memory checking

2011-02-16 Thread bittu
WAP or Algo That will check whether the memory allotted to the program at the initial and the memory returned to the system is same or not. Thanks & Regards Shashank Mani -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group

Re: [algogeeks] program for evaluation of remainders

2010-12-08 Thread sunny agrawal
@Ashim with a check that N >=n N can also be less than n On Wed, Dec 8, 2010 at 6:57 PM, Ashim Kapoor wrote: > Let me try. Any thing involving n would leave no remainder. > > so (1 + 2 ! + ... + n ! + + N !) mod n = (1 + 2 ! + ... + (n-1)! ) > mod n > > This should be computed from a loop.

Re: [algogeeks] program for evaluation of remainders

2010-12-08 Thread Ashim Kapoor
Let me try. Any thing involving n would leave no remainder. so (1 + 2 ! + ... + n ! + + N !) mod n = (1 + 2 ! + ... + (n-1)! ) mod n This should be computed from a loop. I don't know how to reduce it further. Ashim. On Wed, Dec 8, 2010 at 6:49 PM, ankit sablok wrote: > Q) can anyboy fin

[algogeeks] program for evaluation of remainders

2010-12-08 Thread ankit sablok
Q) can anyboy find me the solution to this problem Given an integer N and an another integer n we have to write a program to find the remainder of the following problems (1! + 2! + 3! + 4! + . + N!)mod(n) N<=100 n<=1000; please help me write a program for this problem tha