I don't have "intelligence." I just have narrow-minded focus. I spent three whole days on a sorting algorithm recently.
It has a fairly unusual (for sorting algorithms) property of being O(n * sqrt(n)), resembling patience sort. I need to make it space-stable and it'd be good on certain categories of data. Most likely nothing will come out of it but my point isn't to show off the algorithm. It's to show my single-mindedness fixation that can keep me busy on these topics for days.
The same single-mindedness also enabled me to throw away alcohol without a second thought after over a decade of near-daily drinking. I already lost count of days sober.
Sure, it's got downsides, but so does everything else. In my perception, ADHD is all the "bad" parts of myself.
Python:
def do_sort(unsorted_list):
global iterations
iterations += 1
if not unsorted_list:
return unsorted_list
leftovers = []
ordered_list = [unsorted_list[0]] # Start with the first element as ordered
for i in range(1, len(unsorted_list)):
# If the current element is in order, append them to the ordered list
if unsorted_list[i] >= ordered_list[-1]:
ordered_list.append(unsorted_list[i])
else:
# element is out of order, throw them in the leftovers
leftovers.append(unsorted_list[i])
# Optional - print out iterations and length of list.
print("Iteration: %s List length: %s Ordered list: %s Percent: %.2f" % (iterations, len(unsorted_list), len(ordered_list), 100.0*(len(ordered_list) / len(unsorted_list))))
# Sort the leftovers (recursively)
leftovers = do_sort(leftovers)
# Merge the ordered list and leftovers
return merge(ordered_list, leftovers)
It has a fairly unusual (for sorting algorithms) property of being O(n * sqrt(n)), resembling patience sort. I need to make it space-stable and it'd be good on certain categories of data. Most likely nothing will come out of it but my point isn't to show off the algorithm. It's to show my single-mindedness fixation that can keep me busy on these topics for days.
The same single-mindedness also enabled me to throw away alcohol without a second thought after over a decade of near-daily drinking. I already lost count of days sober.
Sure, it's got downsides, but so does everything else. In my perception, ADHD is all the "bad" parts of myself.