Given N, the number of persons. The task is to arrange N person around a circular table.
Input: N = 4 Output: 6 Input: N = 5 Output: 24
Approach: It is the concept of Circular permutation i.e. there is no specific starting point in the arrangement, any element can be considered as the start of the arrangement.
For N = 4, Arrangements will be:
Below is the formula to find Circular permutations:
Circular Permutations = (N - 1)!
Below is the impplementation of above idea:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Number of ways to arrange 2*N persons on the two sides of a table with X and Y persons on opposite sides
- Time taken by two persons to meet on a circular track
- Multiplication table till N rows where every Kth row is table of K upto Kth term
- Probability that two persons will meet
- Maximum number of teams that can be formed with given persons
- Minimum time required to complete a work by N persons together
- Arrange numbers to form a valid sequence
- Arrange numbers 1 to N^2 in a Zig-Zag Matrix in ascending order
- Arrange given numbers to form the smallest number
- Count number of ways to arrange first N numbers
- Number of ways to arrange a word such that no vowels occur together
- Number of ways to arrange a word such that all vowels occur together
- Arrange first N natural numbers such that absolute difference between all adjacent elements > 1
- Calculate Stirling numbers which represents the number of ways to arrange r objects around n different circles
- Puzzle | 1000 light bulbs switched on/off by 1000 persons passing by
- Permutations of a given string using STL
- All permutations of an array using STL in C++
- All reverse permutations of an array using STL in C++
- Number of palindromic permutations | Set 1
- Problem on permutations and combinations | Set 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.