[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/sci/ - Science & Math

[Advertise on 4chan]


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


>shit at mental arithmetic
>great at programming, logic, and problem solving

Someone explain this. Am I retarded.
>>
>>13749606
It's more common than you think, a lot of math/cs PhDs I've met also have this trait for some reason
>>
>>13749606
Give some examples of the mental arithmetic that trips you.
>>
Completely common and not at all unusual.
>>
>>13749606
You're good at abstract thinking.
>>
>>13749606
most mathematicians are bad at it as well

understanding deeper mathematical structure and properties is an entirely different skill from memorizing a bunch of times tables or being able to add/subtract numbers quickly or some shit

there are frankly very few situations where it is even a useful skill to be particularly good/fast at.
>>
>>13749606
it's called midwitism
>>
>>13749934
Nah, midwits are the ones who are good at mental arithmetic but bad at problem solving
>>
>>13749606
Oh so you're good at programming? Given an array find me the contiguous subarray whose sum is the biggest of all subarray, including the entire array.
>>
>great at mental arithmetic
>great at programming, logic, and problem solving
>>
File: cute_g.jpg (2.6 MB, 2898x4096)
2.6 MB
2.6 MB JPG
>>13749946
I hate code, but here my idea
>each sub array A, starting from original array
-remove negative elements in front and back of array
-divide the array into 3 sub array: x-y-z with x have only positive elements, y only negative elements and have biggest size possible
-compare A, x, z to find array with biggest sum
-repeat the above procedure with subarray z
>terminate
the array have no negative element or is empty
>also
If no positive element in array, simply get the biggest element
>>
>>13750102
My bad
>compare A, x, z to find array with biggest sum
compare the current max-array, not A, with x and z
>>
>>13750102
Your iterative procedure is far too vague. Also the question is to find the largest contiguous subarray, in case you were mixing elements together.
>>
>>13750109
lets me try again
>procedure (array: A, currently max array: S)
-if A empty or have no negative element then return S
-remove negative elements in front and back of array
-divide A into 3 part (contiguous subarray): x-y-z with x have only positive elements, y only negative elements and have biggest size possible
-let maxA = MAX(S, x, z)
-recursively call procedure with parameter (z, maxA)
Now if original array have no positive element, return biggest element, if not then call above procedure with original array as both parameter
>>
File: kadane-Algorithm.png (18 KB, 564x345)
18 KB
18 KB PNG
>>13750131
>divide array into x y z and pass x and z as an argument recursively
The subarray has to be contiguous, eg you can't remove numbers from it.
>>
>>13750163
No I meant compare x and z to find which array have bigger sum. Imagine 2 number m and n, then x is the array from 0 to n, y is from n+1 to m, and z is the rest
>>
>>13750172
Curious what is your race?
>>
>>13750195
asian, live in asia. not OP btw
>>
>>13750250
That explains the terrible answer then pajeet
>>
>>13749946
create a new array of the same length as input, with each element containing two values.

start a nested loop at index 0 of the original array, and add all values traveling right, keeping track the maximum sum and the second index defining the subarray. Store the maximum sum and its right endpoint index in the second array.


iterate this loop rightward for each element in the original array. each loop only has to care about sub arrays to the right of the starting index. You could use some heuristic to skip starting the loop on negative values or 0 if you've seen positive values before.

at the end of this loop you will have new array with all the largest subarrays. each index contains the max sum and right endpoint index of the sub array. sweep through to finding the element with maximum sum. (or track the global max as the first loop runs)
>>
>>13750264
Nigger I'm east asian and I'm fucking east asian chick rn. Also I'm quite confident in my answer, z is the only array that can contain a better sum
>>
>>13749946
Sliding window. This doesn't show someone is good at programming lmao, it's ezpz.
>>
>>13750282
Bro you can't divide the array lmao. The answer gotta be a contiguous subarray. Dividing it and fucking with it fucks shit up.

At most you can remove the elements at the edges if they are negative and do it till they aren't.
>>
>>13749946
depends on the array.
>>
File: divide array.png (7 KB, 873x428)
7 KB
7 KB PNG
>>13750544
is this okay?
>>
>>13749946
>he thinks this is a tough question
Please remove yourself from the genepool
>>
>>13749784
>most mathematicians are bad at it as well
Thats not true
>>
>>13750102
>>13750280
>>13750536
You all just got baited into helping a high schooler with their Java 101 homework.
>>
>>13750636
Good bait, its mental candy.
Not like the other bait people toss out here.
>>
>>13750636
Damn bro, I got used like a condom by a machiavellian high schooler, how will I ever recover
>>
Numerical anxiety



Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.