36 lines
2.9 KiB
Plaintext
36 lines
2.9 KiB
Plaintext
[video output=day233 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Can We Merge Sort In Place?" vod_platform=youtube id=A59NnNt9hRo annotator=Miblo]
|
|
[1:12][handmade_render_group.cpp: Note that the current SortEntries function is O(n^2), and introduce an early-out condition]
|
|
[3:08][Introducing this condition changes the "expected running time" from O(n^2) to something less]
|
|
[3:57][handmade_render_group.cpp: Introduce MergeSort]
|
|
[8:58][Blackboard: Can we Merge Sort in place?]
|
|
[14:22][handmade_render_group.cpp: Introduce a validator for the sorting functions]
|
|
[15:30][Debugger: Run the game and hit that assertion, before correcting the test]
|
|
[16:18][handmade_render_group.cpp: Continue working on MergeSort, interleaving the tests]
|
|
[23:25][Blackboard: Draw out the scenario]
|
|
[24:04][handmade_render_group.cpp: Introduce Half0StackCount and write out all the cases explicitly]
|
|
[26:46][Blackboard: Walk through the problem]
|
|
[28:16][handmade_render_group.cpp: Introduce Swap]
|
|
[30:08][handmade_render_group.cpp: Step 1 - Find the first out-of-order pair]
|
|
[31:39][Blackboard: The two phases of this merge sort algorithm]
|
|
[31:56][handmade_render_group.cpp: Label the steps]
|
|
[34:14][Blackboard: Walk through the next phase]
|
|
[35:54][handmade_render_group.cpp: Step 2 - Swap as many items as necessary]
|
|
[40:26][Blackboard: Draw out the current situation]
|
|
[43:53][handmade_render_group.cpp: Step 3 - Swap back as many swapped half0 items as necessary]
|
|
[51:37][Blackboard: Rearranging the entries]
|
|
[55:20][Blackboard: Consider how to swap the order of these blocks]
|
|
[59:22][Blackboard: Consider the two cases]
|
|
[1:01:45][Blackboard: Walk through what happens]
|
|
[1:06:06][handmade_render_group.cpp: Just set ReadHalf1 = InHalf1]
|
|
[1:06:48][Blackboard: Construct a case and see what happens]
|
|
[1:10:43][Blackboard: On the apparent need to store those back pointers]
|
|
[1:13:15][handmade_render_group.cpp: Make MergeSort take some temporary storage and rewrite SortEntries to use that storage]
|
|
[1:19:29][Debugger: Hit an assertion before fixing the test and seeing that the sort is correct]
|
|
[1:23:49][Q&A][:speech]
|
|
[1:24:09][@insofaras][I didn't look this up so it might not work, but came up with: whenever an element from the upper half is chosen, put it in place in the lower half, shift the upper half down to fill the space that the chosen element used to take up, and store the non-chosen element from the lower half in the new space at the end of the upper half, setting the lower half's read pointer to that end bit. Thoughts?]
|
|
[1:25:08][@AlephAnt][Off-topic, but I made a post about the 2^(2^n)) arguments for TSP on the forums, if you're interested]
|
|
[1:25:19][@robertogracia][Could you post the bit of rotation math in the pre-stream in the Youtube Channel?]
|
|
[1:25:38][@fierydrake][One of the variants in the Wikipedia article claims only one slot + O(1) extra pointers, required.]
|
|
[1:28:02][Wrap it up][:speech]
|
|
[/video]
|