this post was submitted on 22 Jun 2024
404 points (97.4% liked)

Programmer Humor

19291 readers
1247 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] MinekPo1@lemmygrad.ml 1 points 3 months ago

if I'm not mistaken , a example of a problem where O(n!²) is the optimal complexity is :

There are n traveling salespeople and n towns . find the path for each salesperson with each salesperson starting out in a unique town , such that the sum d₁ + 2 d₂ + ... + n dₙ is minimised, where n is a positive natural number , dᵢ is the distance traveled by salesperson i and i is any natural number in the range 1 to n inclusive .

pre post edit, I realized you can implement a solution in 2(n!) :(