top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do you shuffle a binary tree without using any external data structures.

+1 vote
1,016 views

How do you shuffle a binary tree without using any external data structures.
Note: With equal probability to every node.

posted Sep 11, 2014 by Atiqur Rahman

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
Can I use an array???
Suppose array is allowed then we can create an array out of the binary tree (delete node when you take out an element) so at the end u have an array and null tree. Now choose random element from the array and insert into the tree till end. Please comment if looking something different.
No extra space is allowed and the structure of the BT should not change... sorry for late comment!
I give up :) no clue at all
You can answer for the larger audience reach :)

...