[algogeeks] Puzzle Digest Of The Week [6th-June to 10th June]

2011-06-11 Thread Lavesh Rawat
*Puzzle Digest Of The Week 6th-June to 10th June* * * * http://dailybrainteaser.blogspot.com/2011/06/find-next-number-in-series-10-june.html?lavesh=lavesh * * * * http://dailybrainteaser.blogspot.com/2011/06/secret-code-puzzle-9-june.html?lavesh=lavesh * * * *

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
i did the same prob wit range maximum query.. but im repeatedly getting wrong answer.. im stuck with this prob for a long time.. pls help.. my code: #includeiostream using namespace std; #includestdlib.h #includestdio.h int A[50010]; int M[999]; void initialize(int node, int b, int e) {

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread keyan karthi
k=query(x,y-1) if(k==x) count++ with this change ur code ACs :) On Sat, Jun 11, 2011 at 1:24 PM, Radhika Renganathan radi.coo...@gmail.comwrote: i did the same prob wit range maximum query.. but im repeatedly getting wrong answer.. im stuck with this prob for a long time.. pls help.. my

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
yea.. now got ac.. :) mistake was k==y is also possible but xk fails.. so got WA .. thank u :) On Sat, Jun 11, 2011 at 2:39 PM, keyan karthi keyankarthi1...@gmail.comwrote: k=query(x,y-1) if(k==x) count++ with this change ur code ACs :) On Sat, Jun 11, 2011 at 1:24 PM, Radhika Renganathan

Re: [algogeeks] Re: SPOJ THRBL

2011-06-11 Thread Radhika Renganathan
im sorry .. yk fails :D On 6/11/11, Radhika Renganathan radi.coo...@gmail.com wrote: yea.. now got ac.. :) mistake was k==y is also possible but xk fails.. so got WA .. thank u :) On Sat, Jun 11, 2011 at 2:39 PM, keyan karthi keyankarthi1...@gmail.comwrote: k=query(x,y-1) if(k==x)

Re: [algogeeks] Reverse the bits.

2011-06-11 Thread dinesh bansal
Thanks Guys I got it. @balaji... you are right.. it will work just fine. -Dinesh Bansal On Fri, Jun 10, 2011 at 10:22 PM, Vetri Balaji vetribal...@gmail.com wrote: int flip(int j,int k,int n) {   int t1=(1j)-1;   int t2=(1k)-1;   t1=t2^t1; return n^t1; } correct me if im wrong On Fri,

[algogeeks] C OUTPUT HELP

2011-06-11 Thread nicks
Hello friends..plz help me in understanding the following C Output first one is -- #includestdio.h #includeconio.h main() { int a=5; printf(a=%d\n,a); printf(%a=%d,a); getch(); } *OUTPUT - * a=5 0x1.2ff380p-1021=4199082 and the other one is -- #includestdio.H # include conio.h int i=2; main()

[algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread Abhishek Goswami
Hi, Can anyone have algorithm or program for convert word into number Input. Three hundred twenty three : output 323 InputTwenty : output -20 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] C OUTPUT HELP

2011-06-11 Thread Vishal Thanki
In 1st program, 2nd printf requires one more argument. And basically %a is used for printing a double value in hex. see man 3 printf. On Sat, Jun 11, 2011 at 5:29 PM, nicks crazy.logic.k...@gmail.com wrote: Hello friends..plz help me in understanding the following C Output first one is --

Re: [algogeeks] C Question

2011-06-11 Thread rahul rai
To clear pointer basics and dwell deep into the subject please WORK OUT THESE video series ALONGwith The assignments . . http://see.stanford.edu/see/lecturelist.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755ee On 6/8/11, Vishal Thanki vishaltha...@gmail.com wrote: Following declaration makes the

Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread rahul rai
I wonder if there is any practical use of this algorithm for real life implementation . . Please let me know where you caught this problem On 6/11/11, Abhishek Goswami zeal.gosw...@gmail.com wrote: Hi, Can anyone have algorithm or program for convert word into number Input. Three hundred

Re: [algogeeks] Re: Scheduling

2011-06-11 Thread Algoose chase
Will this work ? Order by choosing the last element of the permutation first. initially Calculate T = Total time of all tasks and calculate for all i, (T-Ti)*Ci and choose the task with min among them as last. To find the next last element , re-calculate T = T-Ti(i being the element chosen in

Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread rahul rai
Count the number of spaces in the sentence. If the last word is {one/two .} the just do the calling on the speciab part of code printing the rest of sentence On 6/11/11, rahul rai raikra...@gmail.com wrote: I wonder if there is any practical use of this algorithm for real life

[algogeeks] Re: please help me

2011-06-11 Thread siva viknesh
http://geeksforgeeks.org/ On Jun 8, 4:07 pm, coder dumca coder.du...@gmail.com wrote: I am last year  student preparing for placements can any one give some ebooks on data structure,  algo etc.  like beofre some time , some one posted a book how to crack the coding interview  that was an

[algogeeks] Swapping two variables without using a temporary variable

2011-06-11 Thread Wladimir Tavares
Swapping two variables without using a temporary variable using the + and -: x = a; y = b; x = x + y / / x = a + b; y = x - y / / y = a + b-b = a; x = x - y / / x = a + b-a = b; y = b; x = a; Problems with this approach: 1) It can cause overflow in the operation (+) 2) It can cause underflow

Re: [algogeeks] FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread Umer Farooq
Where is the admin of this group? These guys are discussing something completely irrelevant to Algorithms. Could anyone please take a notice of this in order to maintain the dignity of this group and filter the spam? On Fri, Jun 10, 2011 at 8:30 PM, coder dumca coder.du...@gmail.com wrote: so

Re: [algogeeks] Re: finding whether sum of two numbers of array is equal to given number or not ? plz tell why my this is not working for x=10,11,13 values

2011-06-11 Thread Amit Chauhan
Hi, For x = 10,11,12,13 it is going in infinite loop. Your recursive call for binary_search function is going in infinite loop. So please look in to the logic for binary search function. And one more thing once you sort the array and after this you can search the pair in linear time { for

Re: [algogeeks] Re: MS Interview

2011-06-11 Thread Ashim Kapoor
Could someone illustrate the XOR for question 2. I am a beginner to this. Many thanks! On Thu, Jun 9, 2011 at 4:58 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: Xoring it twice ...once with the elements in the file and then from i=1 to 4,000,000,000..the answer left is the missing number

Re: [algogeeks] Samsung Bangalore is hiring a lot!!!!

2011-06-11 Thread vamsi achyuth
Is it for freshers? On 7 June 2011 23:14, sayan nayak sayanna...@gmail.com wrote: Multiple openings in Samsung Bangalore in following domains: 1. Wireless protocols 2. Android 3. Multimedia 4. Browser 5. mobile application. 6.Embedded System. interested people can send their

Re: [algogeeks] MS Q

2011-06-11 Thread Ashim Kapoor
I think RGGB is invalid as we have 4 different colors. On Fri, Jun 10, 2011 at 10:10 AM, Harshal hc4...@gmail.com wrote: #includeiostream #includestring using namespace std; void mastermind(char* guess, char* sol, int *hits, int *pseudohits) { int temp[256] = {0}; int

Re: [algogeeks] FOR ALL INDIAN PLS READ IT:::::::

2011-06-11 Thread Vijay Thakur
stop putting spam on this group this is not an official no. and misscall support does not mean any type of support. if this misscall support thing is really true then everybody will come to know through newspaper and television news. On Thu, Jun 9, 2011 at 1:07 AM, PRAMENDRA RATHi rathi

Re: [algogeeks] Re: Microsoft ques : reverse of dutch national flag problem

2011-06-11 Thread Apoorve Mohan
@piyush: at every call to merge u create 3 variables...so u consider this an in-place solution??? On Tue, Jun 7, 2011 at 11:03 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: void merge(int a[], int n, int i) { if(i == 1) { arr[1] = arr[n]; arr[2] = arr[n 1];

Re: [algogeeks] Re: plz tell what is wrong in my this code... This code is for finding whether there are two numbers in array whose sum is exactly equal to given value x or not ... program is given as

2011-06-11 Thread Amit Chauhan
Hi, Your recursive call for binary_search function is going in infinite loop. So please look in to the logic for binary search function. And one more thing once you sort the array and after this you can search the pair in linear time { for searching the element}. *Thanks and Regards * *Amit K

Re: [algogeeks] Re: BST+Heap

2011-06-11 Thread Algoose chase
1. Insert the node(order of insertion is irrelevant) in any order according to the binary search tree properties. 2. Compare the j value of node with its parent recursively (bottom up) and then perform rotations to restore the Heap property. On Thu, Jun 9, 2011 at 12:38 AM, mukesh tiwari

[algogeeks] Re: C Question

2011-06-11 Thread vikas kumar
x is a pointer which can be changed from out side and stores the pointers for int* On Jun 8, 10:58 am, Vishal Thanki vishaltha...@gmail.com wrote: Following declaration makes the x as a volatile pointer to an integer. int *volatile x; But what does following means? int **volatile x;

Re: [algogeeks] Please explain this problem

2011-06-11 Thread Terence
a,b,c,d,e,f do not need to be distinct. (It is possible that a=b=c=d=e=f, see Example 1) On 2011-6-10 12:01, saurabh singh wrote: Problem link- ABCDEF https://www.spoj.pl/problems/ABCDEF/ Can someone please explain this problem.The problem says a,b,c,d,e,f belongs to S.But what if size of S

Re: [algogeeks] Re: MS Interview

2011-06-11 Thread Wladimir Tavares
Suppose you want to find out what the missing number in the list [1 .. 5]: 1 = 001 2 = 010 3 = 011 4 = 100 5 = 101 XOR = 001 If the number 4 is missing: XOR = 001 1 = 001 2 = 010 3 = 011 5 = 101 XOR = 100 You can see that the method works

Re: [algogeeks] Re: MS Interview

2011-06-11 Thread Wladimir Tavares
You will use three properties of XOR on two issues: A XOR A = 0 A XOR B XOR B = A (commutativity) A XOR (B XOR C) = (A XOR B) XOR C (Associativity) Wladimir Araujo Tavares *Federal University of Ceará * On Thu, Jun 9, 2011 at 8:28 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote: Xoring it

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

2011-06-11 Thread sunny agrawal
@terence which game ?? On Fri, Jun 10, 2011 at 3:51 PM, Terence technic@gmail.com wrote: 42, 47 A popular game.:) On 2011-6-10 18:11, ankur aggarwal wrote: 42, 49 2011/6/10 • » νιρυℓ « • vipulmehta.1...@gmail.com 42, 47 just guessing according to the pattern. On Fri, Jun 10,

Re: [algogeeks] C OUTPUT HELP

2011-06-11 Thread PRAMENDRA RATHi rathi
IN second program: in function value are always push in the stack from left. so first value is --i that will make i=1 and pass to function and after that i++ will be passed.that's means i will be passed and after that value will be incremented. so 1 will pass and after passing value. i will

Re: [algogeeks] C OUTPUT HELP

2011-06-11 Thread PRAMENDRA RATHi rathi
IN second program: in function value are always push in the stack from right. so first value is --i that will make i=1 and value 1 will be passed to function and after that i++ that's means i will be passed. so 1 will be passed and after passing value. i will changed to 2. if u want to know why

Re: [algogeeks] Print 1 to n without loops

2011-06-11 Thread /\/a|-|a/\/t
use goto On Sat, Jun 11, 2011 at 8:55 PM, hary rathor harry.rat...@gmail.com wrote: int main() { static int i=1; int n=100; if(i=n) { printf(%d ,i); i++; main(); } return 0; } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: plz tell what is wrong in my this code... This code is for finding whether there are two numbers in array whose sum is exactly equal to given value x or not ... program is given as

2011-06-11 Thread D.N.Vishwakarma@IITR
I 've got error but anyway thanx On Thu, Jun 9, 2011 at 10:47 AM, Amit Chauhan amitchauhan@gmail.comwrote: Hi, Your recursive call for binary_search function is going in infinite loop. So please look in to the logic for binary search function. And one more thing once you sort

Re: [algogeeks] can i know the best way to learn programming??

2011-06-11 Thread Ajay Kumar
On Wed, Feb 2, 2011 at 4:35 PM, Ajay Kumar ajay...@gmail.com wrote: thankx guys!!!1:) i've done the basic c/c++how can i improve my skills??? i'm really intersted in programming... On Wed, Feb 2, 2011 at 3:16 PM, aniket chatterjee aniket...@gmail.comwrote: @Rahul: Awesome link

[algogeeks] Re: Swapping two variables without using a temporary variable

2011-06-11 Thread KK
It wont give correct answer when u pass same values of a and b and such conditions arises in sorting -- *** Kunal Kapadia Computer Science and Engineering B.Tech 2nd yr NIT Trichy *** -- You received this

[algogeeks] Re: remove duplicate chars in a string without using extra memory

2011-06-11 Thread rohit
char *remdup(char *str) { int max_string_length=300; //assume max length is 300 charecters char heapchr[max_string_length]={0}; int input=0; int output=0; char tp; while(*(str+input)!='\0') {tp=*(str+input); if(heapchr[tp]==0) { heapchr[tp]=1; *(str+ouput)=*(str+input); output++; }

Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread Abhishek Goswami
Can you bit descriptive.. On Sat, Jun 11, 2011 at 7:27 PM, rahul rai raikra...@gmail.com wrote: Count the number of spaces in the sentence. If the last word is {one/two .} the just do the calling on the speciab part of code printing the rest of sentence On 6/11/11, rahul rai

Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread Abhishek Goswami
@I got one of my interview . I tried to solve this issue but could not it...I did googling but could not help me much... On Sun, Jun 12, 2011 at 12:26 AM, Abhishek Goswami zeal.gosw...@gmail.comwrote: Can you bit descriptive.. On Sat, Jun 11, 2011 at 7:27 PM, rahul rai raikra...@gmail.com

[algogeeks] Re: find error

2011-06-11 Thread rohit
it is fine no error.:) On Jun 11, 11:35 pm, amit amitthecoo...@gmail.com wrote: #include stdio.h int main() {         struct add         {                 int a;                 int b;         }x, y;         x.a = 10;         y = x;         printf(%d, y.a);         return 0;

Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread sunny agrawal
may be a map can help that maps string to their integer values ans then using some set of rule to convert to a number On Sun, Jun 12, 2011 at 12:28 AM, Abhishek Goswami zeal.gosw...@gmail.comwrote: @I got one of my interview . I tried to solve this issue but could not it...I did googling but

[algogeeks] Re: Swapping two variables without using a temporary variable

2011-06-11 Thread rohit
can u pls explain the overflow and underflow in +- approach On Jun 11, 8:58 am, Wladimir Tavares wladimir...@gmail.com wrote: Swapping two variables without using a temporary variable using the + and -: x = a; y = b; x = x + y / / x = a + b; y = x - y / / y = a + b-b = a; x = x - y / / x

[algogeeks] Re: FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread KK
It works!! Shame on u Umer Farooq u cant even give a call a no for ur nation whereas other are on hunger strike... even if this is algo group so whats the problem???... m sorry to say this... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread kartik sachan
what dignity u are going to maintain.apne desh k liye kuch to karo mere dost.apne desh ki dignity nhi bache gi to is group ki bacha k kya karo ge??and by the i didn't put any thing wrong in the group.many educated indian are there in the group i

Re: [algogeeks] Re: Scheduling

2011-06-11 Thread Arpit Sood
can you give the problem link ? On Thu, Jun 9, 2011 at 12:38 PM, Algoose chase harishp...@gmail.com wrote: Will this work ? Order by choosing the last element of the permutation first. initially Calculate T = Total time of all tasks and calculate for all i, (T-Ti)*Ci and choose the task

Re: [algogeeks] FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread Priyanshu
By this time one would have known that u are from pakistan asshole. At least our country has a chance and hope to recover from this, but ur country will rot in hell u son of a terrorist. PG On Fri, Jun 10, 2011 at 8:59 AM, Umer Farooq the.um...@gmail.com wrote: Where is the admin of this

[algogeeks] Re: Swapping two variables without using a temporary variable

2011-06-11 Thread Andreas Hahn
Well, on pod, this is an alternative to swapping two variables with a third temporary, but be careful with objects! It won't work on all objects and in C++0x there is the move for this purpose. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread Harshal
hey Priyanshu, no offence but that's too much dude!! Not all of them are terrorists and many muslims live in our country also! Those who want to give a call, do it, those who don't want, its their choice! But don't spoil the group by commenting irrelevant. And regarding the admin of the group, its

Re: [algogeeks] Re: Scheduling

2011-06-11 Thread Akshata Sharma
ya aanchal, kaun si problem hai? On Sun, Jun 12, 2011 at 1:41 AM, Arpit Sood soodfi...@gmail.com wrote: can you give the problem link ? On Thu, Jun 9, 2011 at 12:38 PM, Algoose chase harishp...@gmail.comwrote: Will this work ? Order by choosing the last element of the permutation first.

Re: [algogeeks] FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread Priyanshu
hey harshal, i think u r pretty good in assuming things up.Never did i told all muslims are terrorist nor did i told all pakistanis are terrorist. So STFU. On Sat, Jun 11, 2011 at 8:21 PM, Harshal hc4...@gmail.com wrote: hey Priyanshu, no offence but that's too much dude!! Not all of them are

Re: [algogeeks] Re: Swapping two variables without using a temporary variable

2011-06-11 Thread nicks
Hers's another one line solution for swapping two variables a and b a=b+a-(b=a) On Sat, Jun 11, 2011 at 2:55 PM, Andreas Hahn www.gal...@googlemail.comwrote: Well, on pod, this is an alternative to swapping two variables with a third temporary, but be careful with objects! It won't work on

Re: [algogeeks] FOR ALL INDIANS PLZ READ IT

2011-06-11 Thread sharad kumar
please guys maintain the dignity of the forum...btw I'm the group manager. On Sun, Jun 12, 2011 at 9:17 AM, Priyanshu priyanshuro...@gmail.com wrote: hey harshal, i think u r pretty good in assuming things up.Never did i told all muslims are terrorist nor did i told all pakistanis are

Re: [algogeeks] Re: find error

2011-06-11 Thread Balaji S
no error ryt?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this