作业帮 > 综合 > 作业

请问如何用C语言实现下面的迭代和递归的两种算法

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/11 16:11:20
请问如何用C语言实现下面的迭代和递归的两种算法
Given a list of N integers,denoted by A0,A1,…,AN – 1,there are two methods to print them in the given order.The iterative method is very simple:just print the integers one by one through a for-loop.The recursive method is to equally divide the integer set into two parts by the integer in the middle position.Then recursively print the first part,followed by printing the integer in the middle,and finally the second part.
请问如何用C语言实现下面的迭代和递归的两种算法
First,you can solve it like this:
#include
using namespace std;
void printArray1(data_t array[],size_t size){
for(int ii=0; ii