我有编程技能的数据集,我喜欢预处理/清理它并创建一些更通用的组。
这是我的数据集
struct student ** topKStudents(struct student *students, int len, int K) {
student* top_students = (struct student *)(malloc(K * sizeof(struct student)));
struct student temp;
int i;
for (i = 0; i < len - 1; i++){
for (int j = 0; j < len - 1; j++)
if (students[j + 1].score>students[j].score){
temp = students[j];
students[j] = students[j + 1];
students[j + 1] = temp;
}
}
for (i = 0; i < K; i++){
top_students[i] = students[i];
}
return &top_students;
}
答案 0 :(得分:1)
有两种方法可以对数据集进行清理和分类: