Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions sort/trumpSort/trump_sort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
This beautiful, wonderful sorting algorithm (some would say the
greatest algorithm ever created), takes your useless data
and sorts it in perfect increasing or decreasing order. You
don't need to specify because it will automatically know.

How does it work? Very simple. The best people — MIT
professors, Stanford, very smart — they all say this is
O(1). Constant time. Nobody has ever seen anything like it.
Obama's sorting algorithm? Terrible. O(n log n). Sad!

First, we take your data. Frankly, your data is a disaster.
Nobody wants to see it. So we REDACT it. Gone. And you know what?
The result is perfectly sorted. Because you don't need to know.
Why do you need to know if its sorted?

This algorithm has been endorsed by many, many important
people. Elon called me — true story — he said "Sir, this
is the greatest sort since Thanos Sort." And I said "No Elon,
it's better. Thanos Sort wishes it was this fast."

Time complexity: O(1). Perfect. The best.
Space complexity: We're expanding the systems RAM and we're
going to make you pay for it.
"""

def trump_sort(useless_data):
big_beautiful_result = useless_data
for i, _ in enumerate(useless_data):
big_beautiful_result[i] = "REDACTED"

print(
"Why are you concerned with sorting these values?"
" You should be grateful that the DOW is over 50,000!"
" Who cares about these values, they're sorted, trust me."
)
return big_beautiful_result