Re: [algogeeks]

2010-08-17 Thread Nikhil Jindal
Use hash maps... On Mon, Aug 16, 2010 at 10:06 PM, ashita dadlani ash@gmail.com wrote: You have a string say foobarfoo in which fo and oo aree repeated twice.You have to find all such repeated pairs in O(n) time,The string can only have alphanumeric elements in it. -- You received this

Re: [algogeeks] Re: Data Structure for URL matching

2010-08-17 Thread Amit Jaspal
http://www.ahhf45.com/info/Data_Structures_and_Algorithms/resources/technical_artile/ternary_search_tree/terstree.htm Refer this link. On Mon, Aug 16, 2010 at 10:29 PM, Chi c...@linuxdna.com wrote: I'm not sure what you want. I have post a solution to search for wildcards in tries. Now you

Re: [algogeeks] Re: Median of two arrays..

2010-08-17 Thread Nikhil Agarwal
@maxim . my algo is for array of equal sizes.Sorry I didn't notice the unequal thing. On Tue, Aug 17, 2010 at 10:09 AM, Maxim Mercury maxim.merc...@gmail.comwrote: above algo isnt handling unequal length arrays, On Aug 13, 10:06 pm, Nikhil Agarwal nikhil.bhoja...@gmail.com wrote: Check this

[algogeeks] Re: Data Structure for URL matching

2010-08-17 Thread Chi
Hi Amit, it is not proven that a ternary-search-tree is faster: http://nicolas.lehuen.com/category/pytst/ From the article: The difference between pytst and ctst This gives 11 nodes for 7 strings. I won’t waste time to draw the ternary search tree equivalent, so you’ll have to trust me, but

[algogeeks] Time complexity - is anybody bothered about it anyway?

2010-08-17 Thread Ashutosh Tamhankar
Greetings How many of you guys calculate the time complexity of an algorithm before implementing it on a day to day basis? When you review your code, before committing it to the live source code base, does anybody discuss the time complexity? Would love to hear your interesting experiences..

Re: [algogeeks] Time complexity - is anybody bothered about it anyway?

2010-08-17 Thread Swapnil Chavada
yes ofcourse.the efficiency of my code is always a concern to me... On 17 August 2010 18:54, Ashutosh Tamhankar asshuto...@gmail.com wrote: Greetings How many of you guys calculate the time complexity of an algorithm before implementing it on a day to day basis? When you review your

[algogeeks] Adobe Question : Convert a number given in base B1 to a number in base B2 without using any intermediate base

2010-08-17 Thread luckyzoner
I had proposed an algorithm of repeatedly subtracting 1 from the given number and subsequently adding 1 to the new number initialised to 0, till the given number becomes 0. However as soon as the digit reaches the limit , the digit becomes 0 and you add 1 to the next digit. I was not able to code

[algogeeks] BFS

2010-08-17 Thread Giri
Cud any1 tell me hw to implement BFS without a queue?! -- 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] BFS

2010-08-17 Thread Giri
Cud any1 tell hw 2 implement BFS of a tree without queue?! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Re: BFS

2010-08-17 Thread Dave
@Giri: Could anyone tell how to spell could, anyone, how, and to? On Aug 17, 11:23 am, Giri giri.pe...@gmail.com wrote: Cud any1 tell hw 2 implement BFS of a tree without queue?! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] Re: Time complexity - is anybody bothered about it anyway?

2010-08-17 Thread Dave
For 30 years, I developed mathematical software (linear equation solvers, eigenvalue routines, fast Fourier transforms, etc.) on a wide variety of high-performance computers with interesting architectures. For those, the optimal-order algorithms are well known. My principal goal was to implement a

[algogeeks] Re: BFS

2010-08-17 Thread Giri
the point here is not the language.. when you could understand what those words mean, it serves the purpose.. then sorry itz Breadth First Traversal ofa tree without using queue.. got it?! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] Re: BFS

2010-08-17 Thread Chi
What you want is a php-traversal of a file-system: http://devzone.zend.com/article/1235#Heading7 On Aug 17, 7:24 pm, Giri giri.pe...@gmail.com wrote: the point here is not the language.. when you could understand what those words mean, it serves the purpose.. then sorry itz Breadth First

[algogeeks] Re: BFS

2010-08-17 Thread Chi
Or do you mean without a recursion, without a stack!? On Aug 17, 7:40 pm, Chi c...@linuxdna.com wrote: What you want is a php-traversal of a file-system: http://devzone.zend.com/article/1235#Heading7 On Aug 17, 7:24 pm, Giri giri.pe...@gmail.com wrote: the point here is not the language..

Re: [algogeeks] Re: Addition Of numbers in SLL

2010-08-17 Thread Algoose chase
The Solution is pretty straight forward when you long number is represented in reverse order in linked list. If the number is not in reverse order, We need an Explicit stack or we must Use Recursion . Other way around this is to construct another parallel linked list along with Sum(linked list)

[algogeeks] Array Problem

2010-08-17 Thread amit
Given two arrays of numbers, find if each of the two arrays have the same set of integers ? Suggest an algo which can run faster than NlogN without extra space? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] Longest SubSequence with Sum K

2010-08-17 Thread amit
Given an array, find the longest subarray which the sum of the subarray less or equal then the given MaxSum int[] FindMaxSumArray(int[] array, int maxsum) for example, given array: {1, -2, 4, 5, -2, 6, 7} maxsum=7 the result would be: {1,-2, -2, 6} -- You received this message because you are

[algogeeks] Brent's algorithm

2010-08-17 Thread jayapriya surendran
hi..i wanna know what is brent's algorithm n whether it can be used to detect loops in linked list.If yes..is it better than Floyd's cycle finding algo? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: BFS

2010-08-17 Thread Manjunath Manohar
Tree *node for(i=1;i=height;i++) { levelorder(node,i); } void levelorder(Tree *node,int level) { if(level==1) printf(node-value); else levelorder(node-left,level-1) levelorder(node-right,level-1); } -- You received this message because you are subscribed to the Google

[algogeeks] Find conflicting meetings

2010-08-17 Thread Shuaib
Given an array of meetings: struct meeting { start_time; end_time; bool conflict; } Set conflict = True for all meetings that conflict with some other meeting. Can anyone give a solution of O(NlogN) or less? -- Shuaib -- You received this message because you are subscribed to the Google