I know stackoverflow has many questions like this one, but it appears that none of them are actually a solution to this.
I had a coding interview three weeks ago and one of the questions been "How do you sort an array of n people by their name in an alphabetical order ?" problem is not the answer, but Array.Sort()
function was not allowed.
First thing that came in my mind was creating an array of chars of which i i can attempt to get the first char of each string from that array and store them in char[]
, then a nested loop to actually do the job, but after a few minutes passed this has no sense and it was or i think a wrong approach by me.
Looking in the Internet the algo that i am looking for is the Quicksort method, but this totally looks something overcomplicated, do i actually need to learn about Quicksort and replicate the algo myself or there is something less complicated that orders that array of people alphabetically ?