由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 看看人家高手写的排序代码
相关主题
为什么不能成功排序STL里的priority_queue到底有啥用?
请教一个python 问题问一个leetcode的排序问题
[合集] 答案. 未排序的100个数字,如何最快地找出最大的5个如何在将学生成绩排序后,再加一个rank域?
如何将若干已升序排序好的数组合并在一起,并仍然是升序?underlying sort algorithm for SET in STL?
请教一个初级算法问题 (转载)A STL sorting algorithm problem
std::map 为什么没有排序呢问一个基本问题
问个python问题如何 randomize 一个sorted的文件 ?
请问如何用sort命令给数据排序? (转载)如何sort and merge n 个sorted linked list
相关话题的讨论汇总
话题: school话题: rank话题: score话题: total话题: she
进入Programming版参与讨论
1 (共1页)
b**r
发帖数: 352
1
莫非是传说中失传已久的天罗地网排序法?
for(i=0;i<5;i++)
{
if(school[i].total_score==a[0]) school[i].rank=1;
if(school[i].total_score==a[1]&&a[1]!=a[0]) school[i].rank=2;
if(school[i].total_score==a[1]&&a[1]==a[0]) school[i].rank=1;
if(school[i].total_score==a[2]&&a[2]!=a[1]) school[i].rank=3;
if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]==a[0]) school[i].rank=1;
if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]!=a[o]) school[i].rank=2;
if(school[i].total_score==a[3]&&a[3]!=a[2]) school[i].rank=4;
if(school[i].to
s*****g
发帖数: 5159
2
at lease he should use
else if to make it run faster.

【在 b**r 的大作中提到】
: 莫非是传说中失传已久的天罗地网排序法?
: for(i=0;i<5;i++)
: {
: if(school[i].total_score==a[0]) school[i].rank=1;
: if(school[i].total_score==a[1]&&a[1]!=a[0]) school[i].rank=2;
: if(school[i].total_score==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]!=a[1]) school[i].rank=3;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]!=a[o]) school[i].rank=2;
: if(school[i].total_score==a[3]&&a[3]!=a[2]) school[i].rank=4;

S*********g
发帖数: 5298
3
I've seen 10 layers of "if" in one excel cell.

【在 b**r 的大作中提到】
: 莫非是传说中失传已久的天罗地网排序法?
: for(i=0;i<5;i++)
: {
: if(school[i].total_score==a[0]) school[i].rank=1;
: if(school[i].total_score==a[1]&&a[1]!=a[0]) school[i].rank=2;
: if(school[i].total_score==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]!=a[1]) school[i].rank=3;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]!=a[o]) school[i].rank=2;
: if(school[i].total_score==a[3]&&a[3]!=a[2]) school[i].rank=4;

g*****g
发帖数: 34805
4
Better than a gal I had to work with before. She used
1 month to develop total 2 lines of code, and led to a showstopper
bug that I had to use 2 hours to find out.

【在 b**r 的大作中提到】
: 莫非是传说中失传已久的天罗地网排序法?
: for(i=0;i<5;i++)
: {
: if(school[i].total_score==a[0]) school[i].rank=1;
: if(school[i].total_score==a[1]&&a[1]!=a[0]) school[i].rank=2;
: if(school[i].total_score==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]!=a[1]) school[i].rank=3;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]!=a[o]) school[i].rank=2;
: if(school[i].total_score==a[3]&&a[3]!=a[2]) school[i].rank=4;

t****t
发帖数: 6806
5
how did that kind of programmers (i assume she is a programmer) ever get a
job to start with?
or she is super pretty?

【在 g*****g 的大作中提到】
: Better than a gal I had to work with before. She used
: 1 month to develop total 2 lines of code, and led to a showstopper
: bug that I had to use 2 hours to find out.

P********e
发帖数: 2610
6
你还真觉的这么简单的事情?2行倾注了感情的代码是不一样的。

【在 t****t 的大作中提到】
: how did that kind of programmers (i assume she is a programmer) ever get a
: job to start with?
: or she is super pretty?

c**t
发帖数: 2744
7
贴出来让大家瞻仰下

【在 g*****g 的大作中提到】
: Better than a gal I had to work with before. She used
: 1 month to develop total 2 lines of code, and led to a showstopper
: bug that I had to use 2 hours to find out.

g*****g
发帖数: 34805
8
My ex boss was the only one interviewed her. Who knows what's
going on. She's not bad, but 10 yrs too old with 2 kids.

【在 t****t 的大作中提到】
: how did that kind of programmers (i assume she is a programmer) ever get a
: job to start with?
: or she is super pretty?

S*********g
发帖数: 5298
9
I guess that was the lady mentioned in bug's posts multiple times before.

【在 t****t 的大作中提到】
: how did that kind of programmers (i assume she is a programmer) ever get a
: job to start with?
: or she is super pretty?

g*****g
发帖数: 34805
10
大约就是调了一行API返回一个对象,这个对象对应数据库里一行,
然后调了这个对象某个方法。一共两行。
但是数据库这一行很多情况下是没有的,返回就是空。接下来大家
知道会怎样了。偏偏她把这两行放在某个关键方法里,QA也没有发现。
到产品环境里,我从客户端找到服务器集群的log里再找到这个地方就得两小时了。

【在 c**t 的大作中提到】
: 贴出来让大家瞻仰下
相关主题
std::map 为什么没有排序呢STL里的priority_queue到底有啥用?
问个python问题问一个leetcode的排序问题
请问如何用sort命令给数据排序? (转载)如何在将学生成绩排序后,再加一个rank域?
进入Programming版参与讨论
m***i
发帖数: 2480
11
Is it a sorting code? I don't see < or >... It does not look like look
unrolling either

【在 b**r 的大作中提到】
: 莫非是传说中失传已久的天罗地网排序法?
: for(i=0;i<5;i++)
: {
: if(school[i].total_score==a[0]) school[i].rank=1;
: if(school[i].total_score==a[1]&&a[1]!=a[0]) school[i].rank=2;
: if(school[i].total_score==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]!=a[1]) school[i].rank=3;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]==a[0]) school[i].rank=1;
: if(school[i].total_score==a[2]&&a[2]==a[1]&&a[1]!=a[o]) school[i].rank=2;
: if(school[i].total_score==a[3]&&a[3]!=a[2]) school[i].rank=4;

f*****Q
发帖数: 1912
12
人家倾注了多少心血啊,我可能差不多十年没写过排序代码了。都是
XXXArray.sort();就结束了。
b**r
发帖数: 352
13
Don't know, didn't bother to verify the functioning correctness.
Just judging by the look it appears the author intend to do some sorting.

【在 m***i 的大作中提到】
: Is it a sorting code? I don't see < or >... It does not look like look
: unrolling either

s******n
发帖数: 876
14
a girl can increase the productivity of boys.
the boss doesn't care how the work is done as long as it's done.

【在 t****t 的大作中提到】
: how did that kind of programmers (i assume she is a programmer) ever get a
: job to start with?
: or she is super pretty?

n******t
发帖数: 4406
15
she just needs to be prettier than the other girls in the office.

【在 t****t 的大作中提到】
: how did that kind of programmers (i assume she is a programmer) ever get a
: job to start with?
: or she is super pretty?

X****r
发帖数: 3557
16
Now this is the most insightful post I have seen so far in this thread :)

【在 n******t 的大作中提到】
: she just needs to be prettier than the other girls in the office.
1 (共1页)
进入Programming版参与讨论
相关主题
如何sort and merge n 个sorted linked list请教一个初级算法问题 (转载)
嵌入式系统用什么sorting算法比较好?std::map 为什么没有排序呢
如何让python dictionary sorting 的速度变得很快?问个python问题
pointer overflow请问如何用sort命令给数据排序? (转载)
为什么不能成功排序STL里的priority_queue到底有啥用?
请教一个python 问题问一个leetcode的排序问题
[合集] 答案. 未排序的100个数字,如何最快地找出最大的5个如何在将学生成绩排序后,再加一个rank域?
如何将若干已升序排序好的数组合并在一起,并仍然是升序?underlying sort algorithm for SET in STL?
相关话题的讨论汇总
话题: school话题: rank话题: score话题: total话题: she