VOOZH about

URL: https://www.geeksforgeeks.org/dsa/hypercube-graph/

⇱ Hypercube Graph - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Hypercube Graph

Last Updated : 8 Feb, 2023

You are given input as order of graph n (highest number of edges connected to a node), you have to find the number of vertices in a Hypercube graph of order n. 

Examples:  

Input : n = 3
Output : 8

Input : n = 2
Output : 4

In hypercube graph Q(n), n represents the degree of the graph. Hypercube graph represents the maximum number of edges that can be connected to a graph to make it an n degree graph, every vertex has the same degree n and in that representation, only a fixed number of edges and vertices are added as shown in the figure below:

👁 Hypercube Graph

All hypercube graphs are Hamiltonian, hypercube graph of order n has (2^n) vertices, , for input n as the order of graph we have to find the corresponding power of 2.  

Recursive Approach


Output
16

Iterative Approach


Output
16

Java Using Math.pow()


Output
16
Comment
Article Tags:
Article Tags: