if integers are positive,then go on a cycle... like a[2]goes to its final position, the element in a[2]'s final position goes to its final position, and so on... each time on visiting an element, put some marker on it... like make it negative... finally after an element comes to position of a[2], search the array from a[2] onwards to see if any element is unmarked... if there is one, then go on a cycle from that element onwards and proceed... till you visit all element of array... finally change the sign of all elements to positive (remove the markers...)
-- 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.