- 0
- 0
- 约6.61千字
- 约 18页
- 2026-03-25 发布于福建
- 举报
第PAGE页共NUMPAGES页
2026年游戏开发人员面试要点与答案参考
一、编程能力测试(共5题,每题10分,总分50分)
考察方向:C++基础、面向对象编程、数据结构与算法
1.题目:请编写一个C++函数,实现快速排序算法,并对数组`[34,7,23,32,5,62]`进行排序。要求:
-不能使用STL中的排序函数。
-说明快速排序的核心思想。
答案:
cpp
includeiostream
includevector
usingnamespacestd;
intpartition(vectorintarr,intlow,inthigh){
intpivot=arr[high];//选择最后一个元素作为基准
inti=low-1;
for(intj=low;jhigh;j++){
if(arr[j]=pivot){
i++;
swap(arr[i],arr[j]);
}
}
swap(arr[i+1],arr[high]);
returni+1;
}
voidquickSort(vectorintarr,intlow,inthigh){
if(lowhigh){
intpi=partition(arr,low,high);
qui
原创力文档

文档评论(0)