what if your sort the element.first time.. applying binary search on list for x1 (getting minimum index ) applying binary search on list for x2(getting maximum index) element between this index will be the answer. complexity:O(log(N)) for getting the range. (not considering the sorting)
On Wed, Mar 31, 2010 at 11:55 AM, BlackdiamonD <patidarc...@gmail.com>wrote: > ok...sorry u asked the data structure...... > > > On Wed, Mar 31, 2010 at 11:54 AM, BlackdiamonD <patidarc...@gmail.com>wrote: > >> is the list is sorted...or in some order... >> i feel unless the point in the list in some order eg: sorted, >> it will be difficult to get soluiton less than O(n).... >> >> >> On Wed, Mar 31, 2010 at 4:59 AM, Priyanka Chatterjee <dona.1...@gmail.com >> > wrote: >> >>> Design an efficient algorithm to report all the points within x1 and x2 >>> from a list of N integers. >>> What data structure will you use to implement this algorithm? >>> Find the order of complexity . ( An O(N) solution is not asked) >>> >>> >>> -- >>> Thanks & Regards, >>> Priyanka Chatterjee >>> Third Year Undergraduate Student, >>> Computer Science & Engineering, >>> National Institute Of Technology,Durgapur >>> India >>> http://priyanka-nit.blogspot.com/ >>> >>> -- >>> 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+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> ~~~~BL/\CK_D!AMOND~~~~~~~~ >> > > > > -- > ~~~~BL/\CK_D!AMOND~~~~~~~~ > -- ~~~~BL/\CK_D!AMOND~~~~~~~~ -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.