[algogeeks] Help for Indus Valley partners!

2012-07-27 Thread s_m154
Can you please tell the kind of algos that will be asked for the interview 
and what all subjects to focus for?

-- 
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/-/vCR90sqfDDMJ.
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] Re: absolute minimum difference

2012-07-27 Thread s_m154
Can you please give the algo of solving it in O(nlogn)

On Friday, 27 July 2012 15:35:24 UTC+5:30, Navin Kumar wrote:

 Given array of integers (0 or +ve or -ve value) find two elements having 
 minimum difference in their absolute values.
 e.g. Input {10 , -2, 4, 9,-20,17,-8,14,12)
 output {9,-8}

 I have solved it in O(nlogn). can it be solved in O(n).


-- 
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/-/-gzyD6CoO6gJ.
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] Re: absolute minimum difference

2012-07-27 Thread s_m154

and just for confirming.. will the algo for O(n2) be:
// uses kind of selection sort technique
 
  mindiff = abs(a[1]-a[2]) //take a default min value 
for i= 1 to n  
  for j= 1 to n  
  if i==j   // same no.
  continue 
  if abs(a[i]-a[j])  mindiff // if difference of some other pair of no 
is smaller
a=a[i], b=a[j] // save those no.s
mindiff = abs(a[i]-a[j])  // make that difference the smallest


print a,b



I am quite new to programming so please tell me if what i have written is 
correct even though I know it has a higher complexity. 
Thank you.

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