« first day  last day (15 days later) » 

00:01
I need you to tell me why it is true
In general, for any N things, one can calculate the average by adding them together and then dividing by N. Each of them contributes (1/N) to that average.
So when you asked if (1+2+3+4)//4 would work to average all four of 1, 2, 3, and 4, the answer is yes, it does in fact do so.
that's just not a useful fact to us here
because when we're trying to find the next pivot point, we want the pivot to be between the lowest possible thing and the highest possible thing, excluding the things we already ruled out
(the average of all the indexes starting from 0 and going to the entire length of your list just puts you halfway through the list -- it's the same number you'd get if you took the max value and divided by 2, so it gives you only the first pivot and can't be used to find other, later pivots)
(I'm fudging over the difference between integer and float rounding here; can deal with that after the concepts otherwise make sense)
that said, we've got a larger audience and I need to be leaving, so if the above isn't adequate explanation I'll leave it to someone else to try their hand
then, is (1+2+3+4) // 4 equivalent to (1 + 4) // 2 for averaging N numbers?
no, but we don't need to average N numbers
well it's accidentally equivalent for that example, but not in general
So why does (2 + 3) // 2 give me the index in the middle?
I'm going crazy :)
the middle between the indices 2 and 3? there's not a lot of middle there, seeing as they're right next to each other
you get 2 because the division rounds down but it's an edge case
00:14
who invented this formula in this algorithm?
I'm not sure it was ever considered nonobvious enough to credit
idk but basically anyone could have, it's basic arithmetic after all
there's not a lot of middle there, seeing as they're right next to each other - that's what I don't understand
That 2 and 3 are next to each other?
no, this "there's not a lot of middle there"
00:16
There's not a lot of middle because they're next to each other.
I just mean, let's say you have two books on a shelf, and I say "pick the middle one" .. which book is in the middle?
I think I will go back to elementary school and then study computer science.
I still don't understand guys, I'm going to keep understanding this and later I'll open another question or maybe I'll change my career :)
thanks
anyway

« first day  last day (15 days later) »