Re: [algogeeks] Sorting for large data

2012-01-14 Thread Deepak Nettem
External Memory Sort. The Algorithm is based on Merge Sort.

Divide  data into chunks of the size of your RAM. Let's say you have k
chunks. Such that k x size of RAM = size of your total data.
Sort the chunks independently.
Perform a k-way merge of these chunks.



On Sat, Jan 14, 2012

 Could any point out me any algorithm and program  if we need to sort to
 large data
 like 10 ^ 80 with memory constraint. Suppose you have minimum memory like
 4 MB.

 I am not sure that this algo discussed or not but i was not able to find
 in this group.

 Thanks
 Abhishek

  --
 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] Detect a loop with just head ptr given

2011-12-08 Thread Deepak Nettem
If you allow storing an extra bit with every node (to mark whether a node
has been visited), you can do it with just one pointer. But that's less
space efficient (O(n)) than using two pointers of varying speeds.

On Thu, Dec 8, 2011 at 9:04 AM, Ankur Garg ankurga...@gmail.com wrote:

 U cant create any new ptrs .Just use this ptr :)


 On Thu, Dec 8, 2011 at 6:30 PM, Prem Krishna Chettri 
 hprem...@gmail.comwrote:

 Ofcourse we can..

U knw the head address now U start visit the list what is the big
 deal?? Jst u gotto create two pointer say fast and slow with two diff speed
 of action..

 On Thu, Dec 8, 2011 at 6:27 PM, Ankur Garg ankurga...@gmail.com wrote:

  Can we detect if a loop is present in Linked List if only head ptr is
 given

 --
 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] facebook interview question

2011-12-04 Thread Deepak Nettem
Greetings!

The strategy should be to process the elements in pairs - and compare the
larger element with current maximum, and smaller element with current
minimum.

loop runs upto n in steps of 2, and in each iteration, there are 3
comparisons:
- between (i)th and (i+1)th element
- between min(i, i+1) and current_min
- between max(i, i+1) and current_max

That gives 3n/2 comparisons. Instead of doing 2 comparisons for every
element (with min and max), now you're doing 3 comparisons for every pair -
which makes it effectively 1.5 comparisons for each element. That's how the
n/2 comparisons are saved.

I hope the idea is clear.

On Sun, Dec 4, 2011 at 11:32 AM, Anika Jain anika.jai...@gmail.com wrote:

 refer algorithms by cormen for this


 On Mon, Nov 28, 2011 at 9:56 PM, Nitin Garg nitin.garg.i...@gmail.comwrote:

 Find the min and max in an array. Now do it in less than 2n comparisons.
 (they were looking for the solution that finds both max and min in about
 3/2 n comparisons).


 --
 Nitin Garg

 Personality can open doors, but only Character can keep them open

 --
 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.




 --
 Regards
 Anika Jain

  --
 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.




-- 
Best Regards,
Deepak

-- 
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.