Time complexity:
Oh, I see you're having a problem with your array being unsorted? You know, when I was your age, my array also wasn't sorted and I was worrying that it would never become sorted. Now listen, it gets better over time. You might not believe it, but arrays at this age don't know what they want and don't care about the order of their elements, but as you get older, they will slowly realize that what really matters is having their elements in ascending order, and one day, your array will come up to you and be perfectly sorted. Trust me, you just need to give it time and focus on more important things like rotating AVL trees, because if you put too much weight on sorting your array, you won't realize that there is so much more to programming. I need to tell you about my uncle. He was also a programmer and his arrays were always unsorted. He used to spend a lot of time worrying about it. Fortunately, Stack Overflow didn't exist back then, otherwise he might have searched there and become an array hater. Anyways, one day he just decided to give up, started running Bogosort and focused on other things. And you know what, in a few days, he suddenly found the array being perfectly sorted… and since then, it's been in a happy ascending order for over 30 years!
If you want to increase your chances of sorting your array though, I do have a few tips for you. Most importantly, you need to meet more arrays. You have to realize that arrays can be very useful even if they aren't sorted. You can't say you are ready for working with a sorted array if you aren't comfortable working with unsorted arrays. There are so many ways you can make new arrays – you can declare them like int array[8];
, use calloc()
or even write the assembly instructions manually. You should also read books with array protagonists, they will help you see that arrays aren't just a way to store elements in ascending order, but they have many more uses beyond being sorted. Because no matter what the toxic Stack Overflow users tell you, arrays are sequential data structures just like linked lists and you can treat them exactly the same. You should also keep your code clean and get a new color scheme for your text editor. And finally, you must not feel entitled to a sorted array. Nobody owes you a good sorting algorithm. Anyways, I hope this helped and remember to share this with your Stack Overflow friends so you can leave the crab bucket together!
In computer programming, an algorithm is a sequence of steps that can be followed to solve a specific problem. One such common problem is sorting an array (a list of numbers or other things) to be in ascending order. There exist many sorting algorithms and a common way to rank them is time complexity, which expresses how fast the algorithm can finish in proportion to the number of items in the array.
This article proposes a joke sorting algorithm that is meant to resemble the advice commonly given to heterosexual men who have trouble finding a partner.
Stack Overflow is a famous website where programmers can give advice to each other. Here it's meant as an analogy to internet forums for lonely men, which are falsely believed to commonly express hate toward women.
To comment, use this mailing list.