What does it mean if an operation is O(n!)?

Technology CommunityCategory: Big-O NotationWhat does it mean if an operation is O(n!)?
VietMX Staff asked 3 years ago

O(n!) an algorithm that “tries everything,” since there are (proportional to) n! possible combinations of n elements that might solve a given problem. It means to do something for all possible permutations (possible ways in which a set or number of things can be ordered or arranged) of the N elements. Traveling salesman is an example of this, where there are N! ways to visit the nodes, and the brute force solution is to look at the total cost of every possible permutation to find the optimal one.