cch123 / blog_comment

comments of xargin.com
8 stars 0 forks source link

talent-plan tidb 部分个人题解-week 1 #118

Open cch123 opened 5 years ago

cch123 commented 5 years ago

http://xargin.com/talent-plan-week1-solution/

yyyiue commented 5 years ago

dst := arr[offset: offset+size] // ... resultArr := make([]int64, 0, len(arr)) 最后再 copy(arr, resultArr)

原地局部排序好像没问题吧...

cch123 commented 5 years ago

@yyyiue ,应该是有问题的,我记得好像原地局部排序测试过不了哎 orz,莫非我写错了

yyyiue commented 5 years ago

@cch123 @yyyiue ,应该是有问题的,我记得好像原地局部排序测试过不了哎 orz,莫非我写错了

我一开始也过不了,调试发现是因为resultArr和arr引用了同一个数组,往resultArr里append修改了arr...

cch123 commented 5 years ago

@yyyiue ,噢,这么一说确实~

cch123 commented 5 years ago

@yyyiue ,噢,这么一说确实~

yyyiue commented 5 years ago

@cch123 😄