*STEP-1* Construct a self balancing Binary Search Tree where in the nodes represents the elements of the given set...... *STEP-2* Depending on the K (no. of partitions) keep a counter k *STEP_3* * * If BST not empty continue to Step-4 else exit with failure...... *STEP-4* And while doing any traversal technique on BST keep on decrement the k value and display the node values and delete them . *STEP-5* Once the first set is displayed again initialize k value and repeat Step-3
On Sun, Oct 30, 2011 at 6:41 PM, SAMMM <[email protected]> wrote: > An array is given consisting of real integers , can hav repeatative > elements , Now u need to find K partitions whose union will hav all > the elements of the array , but the intersection of any pair of > cannot hav K elements in common. > > Exam:- > Array- 1 1 2 2 3 1 4 3 5 > > For K=3 the partition are :- > (1 2 3) (1 5 2) (1 4 3) > > > cann't be :- (1 2 3)(3 1 2)(1 4 5) > > -- > 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?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 [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?hl=en.
