Tech IndustryJul 20, 2017
Google©ovfefe

Think about the worst possible way to find the largest absolute value in an array.

I doubt that it would be worse than the way the Qualcomm camera driver for Android does it. What the hell! https://github.com/tangxunye/android_vendor_qcom_proprietary/blob/e0666c398903d38e72aeda7042ec2836cd3dba68/mm-camera/mm-camera2/media-controller/modules/isp/hw/modules/rolloff/mlro_to_plro/mlro_utils.c

tangxunye/android_vendor_qcom_proprietary
tangxunye/android_vendor_qcom_proprietary
GitHub
Microsoft $xoxo$ Jul 20, 2017

lol

Uber jdicixhsko Jul 20, 2017

tldr: create an array of absolute values, use a bubblesort function that sorts almost but not quite in place, then return the first item. It's like somebody asked the question in a phone screen and then copy/pasted the solution into their work and called it a day.

Uber HHYr43 Jul 20, 2017

earlier there was a reply here "what's wrong with it?" well it's bubble sort which is so inefficient that its no longer taught in CS intro class...

Google ©ovfefe OP Jul 20, 2017

Quicksort wouldn't make it any better.

Uber HHYr43 Jul 20, 2017

worst case you're correct, since they're both O(n^2) but average would be better at O(n log n)

Uber dadidi Jul 20, 2017

lol no wonder Android is so laggy of developers implement such things...

Microsoft tpyo57 Jul 20, 2017

You seem to be an immature developer. We (mature developers) call this "code reuse". Come and join Microsoft and you'll learn this and many other amazing paradigms!

Microsoft BalooTheBe Jul 20, 2017

Dear god why is it using malloc

Microsoft tpyo57 Jul 20, 2017

Because it's convenient.

Google dookie Jul 21, 2017

architecture independent

Uber djtfsiob Jul 20, 2017

How big is N? If it's only ever 10 then who gives a shit? Then again.. bubble sort... wow. Even Obama wouldn't use it.

Uber dadidi Jul 20, 2017

but why? it's more complicated and take more line of code and more time than doing it right, so while performance might not be at stake, it's still stupid. besides those malloc allocation add the risk of failure...

Microsoft tpyo57 Jul 21, 2017

Obama hater detected

Microsoft biddut Jul 20, 2017

Wow!! Bubble sort? Seriously!!

Workday _Nutella_ Jul 20, 2017

print out the array. mail it to India. have a sweat shop there where this is all they do. show a progress bar that constantly goes from 0 to 100 while user waits

Microsoft ☠Nutella☠ Jul 20, 2017

My 9yo daughter can do this correctly, it's not even hard. wtf. She said "just look at each number and keep track of the biggest one until you've seen all of them" -- we didn't get to the absolute value part but yeah... wow...

Google ©ovfefe OP Jul 20, 2017

indeed.