[algogeeks] Re: [Google] Finds all the elements that appear more than n/3 times
To Mr. B how will you find median in O(n) time? please elaborate. On Wednesday, July 11, 2012 4:01:43 AM UTC+5:30, Mr.B wrote: I found a similar solution looking somewhere else. The solution for this problem is: a. There can be atmost 3 elements (only 3 distinct elements with each repeating n/3 times) -- check for this and done. -- O(n) time. b. There can be atmost 2 elements if not above case. 1. Find the median of the input. O(N) 2. Check if median element is repeated N/3 times or more -- O(n) - *{mark for output if yes}* 3. partition the array based on median found above. - O(n) -- {partition is single step in quicksort} 4. find median in left partition from (3). - O(n) 5. check if median element is repeared n/3 times or more - O(n) *{mark for output if yes}* 6. find median in right partition from (3). - O(n) 7. check if median element is repeared n/3 times or more - O(n) *{mark for output if yes}* its 7*O(N) = O(N) solution. Constant space. we need not check further down or recursively. {why? reason it.. its simple} On Wednesday, 27 June 2012 18:35:12 UTC-4, Navin Kumar wrote: Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more than n/3 times in the list. The algorithm should run in linear time ( n =0 ). You are expected to use comparisons and achieve linear time. No hashing/excessive space/ and don't use standard linear time deterministic selection algo. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/PxIJd3So3tkJ. 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 group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Microsoft Question
On 10/29/11, praveen raj praveen0...@gmail.com wrote: Priority Queue: when popped ... returns the max priority element and if the priorities of two or more elements are same...then they will popped as they are inserted .. when pushed the element : puts the element in the list according to the priority... For making priority queue into Queue:: on popping : make priority of every element same... so on popping... the element...(popped according to which they are inserted) on pushing : insert the element as same priority as other inserted elements For making priority queue into stack..: make priority of elements in increasing order... .. so on popping the element... will pop the topmost element(with the highest priority value).. on pushing the element... push the element... with the priority value more than topmost priority value... With regards, Praveen Raj DCE-IT 3rd yr 735993 praveen0...@gmail.com On Thu, Sep 15, 2011 at 6:37 PM, Yogesh Yadav medu...@gmail.com wrote: For Stack: just make a structure: struct stack_with_priorityqueue { int num; int priority; struct stack_with_priorityqueue *ptr; } now when we add another number just increase the priority... priority++ For Queue: do same...just decrease priority...priority-- ... On Wed, Sep 14, 2011 at 4:41 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: The well known examples of priority queue is minheap and maxheap.. i guess the question is how do we implement one of these(at least) using queue? On Wed, Sep 14, 2011 at 9:08 AM, Ankuj Gupta ankuj2...@gmail.com wrote: I guess the functionality of priority should be maintained On Sep 13, 11:59 pm, Ankur Garg ankurga...@gmail.com wrote: But dude are u saying stack will be implemented as a map with value,priority and then choose element based on priority ? regards Ankur On Tue, Sep 13, 2011 at 10:16 PM, Ankuj Gupta ankuj2...@gmail.com wrote: For stack :- Keep incrementing the priority of each pushed element. So the last pushed element will have the greatest priority and the element pushed first will have lowest priority. For queue:- keep decrementing the priority of each inserted element. On Sep 13, 1:45 am, Ankur Garg ankurga...@gmail.com wrote: How to Implement a Queue with a Priority Queue Similarly how woud you implement Stack with Priority Queue -- 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 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 group, send email to algogeeks@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. -- **Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees *BharatKumar Bagana* **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar * Mobile +91 8056127652* bagana.bharatku...@gmail.com -- 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 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 group, send email to algogeeks@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. -- 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 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 group, send email to algogeeks@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] remove duplicate words from a string
lets take an example... hello naveen how are you naveen? how we can store the word each seperated by space into array if we are considering binary tree??? how we can measure which is smaller than other according to property?? if we store each word into hash table then how we can get those words stored at different places in hash table??? how we know about the indexes where we have store the word because in the end we have to combine all the wordinto string. please tell perfect solution... On Tue, Oct 11, 2011 at 11:00 AM, rahul sharma rahul23111...@gmail.comwrote: if the string is sorted then int rmvDup(char arr[],int arrLen) { int i,j; for (i =1,j=0; i arrLen;i++) { if (arr[j] != arr[i]) { arr[j+1] = arr[i]; j = j+1; } } arr[j]='\0'; return j+1; } On Tue, Oct 11, 2011 at 9:18 AM, sunny agrawal sunny816.i...@gmail.comwrote: @Ankur in Trie at each Node there will be 26 Pointers Stored, and Most of them would be NULL, thats why i think it will waste space, in Balanced Binary Tree i was thinking of storing the Complete Words at a Node. But now i think this is Better - Ternary Search Trieshttp://en.wikipedia.org/wiki/Ternary_search_tries -- Sunny Aggrawal B.Tech. V year,CSI Indian Institute Of Technology,Roorkee -- 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 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 group, send email to algogeeks@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. -- 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 group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] remove duplicate words from a string
remove duplicate words from a string with min. complexityy. -- 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 group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Amdocs
hey gaurav bhai please provide me your phone number..amdocs visiting thapar on 7 oct. On Sun, Oct 2, 2011 at 7:45 PM, gaurav yadav gauravyadav1...@gmail.comwrote: I cracked amdocs interview...u need to stress on following topics.. *ONLINE TEST* 1)UNIX Questions on various commands.Important ones are ls,tr,head,tail,tee,gzip and questions on bash script. 2)SQL Questions on access levels for diff. users,outer join,inner join,left and right join,ddl and dml commands(like delete,truncate,etc) 3)C/C++/Java I choose C...questions were based on finding outputs mainly on pointers,switch,1 question was also about unions. 4)Basic aptitude questions 5)Learning ability A paragraph will be given to you,based on that 3-4 questions were asked.You will have enough time to read to read and answer. *INTERVIEW* *TECHNICAL* 1)C language(pointers mainly) or any other language u choose mainly from c/c++/java. 2)sql(various dml and ddl commands) 3)data strucures 4)basic knowlegde of automata theory(including its mathematical representations) *HR* Just introduce yourself nicely and also him questions when needed to pretend that u are really interested in joining and are flexible with the location and working hours. So ,that's it.Best of Luck !!! -- 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 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 group, send email to algogeeks@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: Amdocs
h anika.amdocs in coming to thapar on 7 oct. On Sun, Oct 2, 2011 at 11:01 PM, Anika Jain anika.jai...@gmail.com wrote: hey sachin: amdocs is coming for job at wich location?? On Oct 2, 8:55 pm, gaurav yadav gauravyadav1...@gmail.com wrote: my number= +919939569122 gtalk id=gauravyadav1...@gmail.com -- 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 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 group, send email to algogeeks@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: Amdocs
they provide first one year job in puneif your profile is testing then it may be at gurgaon On Mon, Oct 3, 2011 at 12:13 AM, Anika Jain anika.jai...@gmail.com wrote: hiii... ok i meant job offer is for Pune or NCR area ??if u knw.. On Oct 2, 11:29 pm, sachin goyal monugoya...@gmail.com wrote: h anika.amdocs in coming to thapar on 7 oct. On Sun, Oct 2, 2011 at 11:01 PM, Anika Jain anika.jai...@gmail.com wrote: hey sachin: amdocs is coming for job at wich location?? On Oct 2, 8:55 pm, gaurav yadav gauravyadav1...@gmail.com wrote: my number= +919939569122 gtalk id=gauravyadav1...@gmail.com -- 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 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 group, send email to algogeeks@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. -- 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 group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: MICROSOFT
@anup,@sukran ithink u both are right in case of binary search tree... we can traverse and then easily find the value... but in case of heap first we have to create the heap and accordingly apply the algo the create min heap. it will be the complex program so simple is bst just traverse by inorder and compare if anyone has simple solution or any other case then plz tell. On Sun, Sep 4, 2011 at 9:56 PM, monish001 monish.gup...@gmail.com wrote: ALGO: 1. For each element 1 to k: insert in into min-heap 2. for each element k+1 to n delete the root of min-heap and insert this item into the min- heap 3. Finally you have a min-heap of k largest numbers and the root is your answer COMPLEXITY: O(n logn) -Monish On Sep 3, 3:03 pm, teja bala pawanjalsa.t...@gmail.com wrote: //Asked in MS please help me with the coding or Give an algorithm Write code to return the kth largest element in a tree ... function prototype is int fucnkth(node *root,int k) -- 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 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 group, send email to algogeeks@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] Min no of moves
12345|12345 F|E WE HAVE TO CREATE THE PATTERN LIKE F E F E F E F E F E ACCORDING TO MY UNDERSTANDING WE CAN DIRECTLY REPLACE THE 2ND WITH SECOND AND 4TH WITH 4TH TELL CORRECT ME IF I AM WRONG AND I AM TRATING WRONG??? On Sun, Sep 4, 2011 at 8:04 PM, *$* gopi.komand...@gmail.com wrote: yes n/4 swaps are required. +1 aditya kumar On Sun, Sep 4, 2011 at 6:32 PM, aditya kumar aditya.kumar130...@gmail.com wrote: swap n/2-1 with n/2+1 , and then n/2-3 with n/2+3 till we reach n-1 . so we need n/4 swaps . On Sun, Sep 4, 2011 at 5:28 PM, Anup Ghatage ghat...@gmail.com wrote: That's interesting. when n = 3 We have been given this :F F F | E E E Swap the middle element and it becomes: F E F | E F E Which is what you want, but when n = 5 F F F F F | E E E E E And you swap the middle element it becomes: F F E F F | E E F E E So the same startegy doesn't apply. But if you do with from the center for every alternate element, it works for n = 3 F F F | E E E F F E | F E E E F E | E F E It also works for n = 5 etc. So, It is a more uniform solution if you may. -- 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 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 group, send email to algogeeks@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. -- Thx, --Gopi -- 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 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 group, send email to algogeeks@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] Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?
PLEASE TELL HOW On Sun, Sep 4, 2011 at 7:23 PM, sarath prasath prasathsar...@gmail.comwrote: another sol which i learned from my friend is think of heap sort... On Sun, Sep 4, 2011 at 6:28 PM, learner nimish7andr...@gmail.com wrote: something I Know using quick sort randomization function we can find kt smallest/largest in unsorted array , but i am not able to write code , please help me in this and provide the code for the same.? Thanks Nimish K. 1st Year IITR -- 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 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 group, send email to algogeeks@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. -- 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 group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?
PLEASE TELL ME HOW WE CAN USE QUICK SORT TO FIND THE ELEMENT BECAUSE IN QUICK SORT ONE ELEMENT IN SHIFT IN ITS RIGHT POSITION ALL LEFTS ARE SMALLER AND ALL RIGHT ARE BIG On Mon, Sep 5, 2011 at POSIT11:55 AM, sachin goyal monugoya...@gmail.comwrote: PLEASE TELL HOW On Sun, Sep 4, 2011 at 7:23 PM, sarath prasath prasathsar...@gmail.comwrote: another sol which i learned from my friend is think of heap sort... On Sun, Sep 4, 2011 at 6:28 PM, learner nimish7andr...@gmail.com wrote: something I Know using quick sort randomization function we can find kt smallest/largest in unsorted array , but i am not able to write code , please help me in this and provide the code for the same.? Thanks Nimish K. 1st Year IITR -- 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 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 group, send email to algogeeks@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. -- 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 group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Min no of moves
PLEASE CORRECT ME ADITYA On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal monugoya...@gmail.com wrote: 12345|12345 F|E WE HAVE TO CREATE THE PATTERN LIKE F E F E F E F E F E ACCORDING TO MY UNDERSTANDING WE CAN DIRECTLY REPLACE THE 2ND WITH SECOND AND 4TH WITH 4TH TELL CORRECT ME IF I AM WRONG AND I AM TRATING WRONG??? On Sun, Sep 4, 2011 at 8:04 PM, *$* gopi.komand...@gmail.com wrote: yes n/4 swaps are required. +1 aditya kumar On Sun, Sep 4, 2011 at 6:32 PM, aditya kumar aditya.kumar130...@gmail.com wrote: swap n/2-1 with n/2+1 , and then n/2-3 with n/2+3 till we reach n-1 . so we need n/4 swaps . On Sun, Sep 4, 2011 at 5:28 PM, Anup Ghatage ghat...@gmail.com wrote: That's interesting. when n = 3 We have been given this :F F F | E E E Swap the middle element and it becomes: F E F | E F E Which is what you want, but when n = 5 F F F F F | E E E E E And you swap the middle element it becomes: F F E F F | E E F E E So the same startegy doesn't apply. But if you do with from the center for every alternate element, it works for n = 3 F F F | E E E F F E | F E E E F E | E F E It also works for n = 5 etc. So, It is a more uniform solution if you may. -- 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 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 group, send email to algogeeks@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. -- Thx, --Gopi -- 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 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 group, send email to algogeeks@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] Min no of moves
it means we r considring d value for 2*n...so need total n passes... On Mon, Sep 5, 2011 at 1:33 PM, aditya kumar aditya.kumar130...@gmail.comwrote: @dheeraj : u are right . i dint read the question properly . i thot there are total n glasses so i answerd : n/4 swaps . bt since we have 2n glass so we need n/2 swaps . i guess gopi did the same mistake @sachin : yes u are also correct since the glasses are identical the order of swapping doesnt matter . yes u can do that way also . the onli thing is dat u will require n/2 swaps . On Mon, Sep 5, 2011 at 12:12 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: i thnk n/2 swaps are required... 1/4 is of the total glasses present.. i.e. 2n/4 ..=n/2 On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal monugoya...@gmail.comwrote: PLEASE CORRECT ME ADITYA On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal monugoya...@gmail.comwrote: 12345|12345 F|E WE HAVE TO CREATE THE PATTERN LIKE F E F E F E F E F E ACCORDING TO MY UNDERSTANDING WE CAN DIRECTLY REPLACE THE 2ND WITH SECOND AND 4TH WITH 4TH TELL CORRECT ME IF I AM WRONG AND I AM TRATING WRONG??? On Sun, Sep 4, 2011 at 8:04 PM, *$* gopi.komand...@gmail.com wrote: yes n/4 swaps are required. +1 aditya kumar On Sun, Sep 4, 2011 at 6:32 PM, aditya kumar aditya.kumar130...@gmail.com wrote: swap n/2-1 with n/2+1 , and then n/2-3 with n/2+3 till we reach n-1 . so we need n/4 swaps . On Sun, Sep 4, 2011 at 5:28 PM, Anup Ghatage ghat...@gmail.comwrote: That's interesting. when n = 3 We have been given this :F F F | E E E Swap the middle element and it becomes: F E F | E F E Which is what you want, but when n = 5 F F F F F | E E E E E And you swap the middle element it becomes: F F E F F | E E F E E So the same startegy doesn't apply. But if you do with from the center for every alternate element, it works for n = 3 F F F | E E E F F E | F E E E F E | E F E It also works for n = 5 etc. So, It is a more uniform solution if you may. -- 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 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 group, send email to algogeeks@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. -- Thx, --Gopi -- 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 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 group, send email to algogeeks@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. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- 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 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 group, send email to algogeeks@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. -- 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 group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] what is the error???
extern try to find the definition of variable var but not able to find so gives the error On Wed, Aug 31, 2011 at 8:26 PM, Rajesh Kumar testalgori...@gmail.comwrote: What we do to remove error?? #includestdio.h extern int var; main() { var=10; return 0; } Regards Rajesh Kumar -- 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 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 group, send email to algogeeks@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] C output
2 3 because d is pointer avriable On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/nf_M_Yoep_EJ. 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 group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- 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 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 group, send email to algogeeks@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.