Abstract

Abstract We present an optimal greedy algorithm which returns a Gray-code labeling of the nodes of an n -dimensional hypercube; that is, a labeling of the nodes with binary strings of length n for which the Hamming distance between two nodes is 1 if and only if these are adjacent in the hypercube. The proposed algorithm is very simple; it uses breadth-first search to guide the greedy choice of nodes and computes the Gray-code label of a node u by performing the logical disjunction of the Gray-code labels of two nodes adjacent to node u . It takes as input a hypercube Q n with N =2 n nodes and runs in O( N log N ) time. Based on the labeling algorithm we propose a recognition algorithm for hypercubes which runs in O( N log N ) time. Thus, in view of the fact that Q n has n 2 n −1 edges, this behaviour is optimal. Both labeling and recognition algorithms incorporate such algorithmic features that they can be optimally implemented in a PRAM model of computation.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.