Can you please tell me what type of constraint is associated with arrays....
Also if i m not wrong to calculate the median of any sets of numbers . The sets of no. should be sorted . So i think it;'s not beneficial to calculate the median of unsorted sets of array. It will be good if more detailed thoughts should be pour to calculate the better complexity in time as well space. --- Peeyush On 6/13/07, Ray <[EMAIL PROTECTED]> wrote: > > > Hi Alkispe, > > I think it is feasible to solve the 2nd problem in O(lgn) on the > condition that the two arrays are sorted. > > Please let me know the algorithm if the problem can be solved for two > unsorted arrays using O(lgn). :-) > > Thanks! > > > On Jun 13, 2:27 pm, "Phanisekhar B V" <[EMAIL PROTECTED]> wrote: > > For the second question its not possible to do it in O(log n), as u need > > O(n) time to read the elements itself. > > You need to check your second question. There might be some constraints > > associated with the arrays. > > > > On 5/19/07, dor <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > 1. You can certainly do it in O(n log(n)) without any additional > > > memory. Sometimes you can bring the complexity down using additional > > > memory (i.e., hashing). > > > > > 2. O(n log(n)) is trivial (sorting). There is a linear time algorithm > > > for finding the median (I call it "median of the medians", I don't > > > know if it has a specific name). Here is a good description of the > > > algorithm (see "Linear Selection" section): > > > > >http://www.cs.princeton.edu/courses/archive/spring06/cos423/Handouts/. > .. > > > > > On May 18, 10:33 pm, alkispe <[EMAIL PROTECTED]> wrote: > > > > Hello everyone i have 2 problems and i need the best algorithms and > > > > the complexity. Can you please help me? > > > > > > 1. Find if in an array there are some elements that appear more than > > > > one times > > > > 2. You have 2 arrays A and B.give the best algorithm for finding the > > > > median of the 2n elements of the two arrays > > > > > > Also for the 2nd question i need an algorithm with complexity > > > > O(log(n)). > > > > > > Please help me- Hide quoted text - > > > > - Show 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---
