数据结构OJ
「已注销」
这个作者很懒,什么都没留下…
展开
-
287基于递归的折半查找
题目#include<iostream>using namespace std;#include<string>//折半查找是什么?二分查找又是什么?//折半查找,又叫二分查找//非递归方法bool halfSearch(int array[], int length, int find) { int low = 0; int high = length - 1; while (low <= high) { int mid = (low + hig原创 2021-07-29 18:20:13 · 823 阅读 · 0 评论 -
258递归实现字符串的逆序存储
题目#include<iostream>using namespace std;#include<string>//递归,字符串逆序?挺难搞的耶//自己调用自己……//str要逆序的字符串,num递归层数//string做形参,是值传递还是址传递?//不会,放弃,参考这个:https://blog.csdn.net/weixin_43722827/article/details/102755802void reverse(string& str,int原创 2021-07-28 12:19:47 · 521 阅读 · 0 评论 -
250Ackermann函数的非递归求值
题目函数定义如下:#include<iostream>using namespace std;int Ack(int m, int n) { if (0 == m) { return n + 1; } else if(m>0&&0==n) { return Ack(m - 1, 1); } else if (m > 0 && n > 0) { return Ack(m - 1, Ack(m, n - 1.原创 2021-07-28 11:33:01 · 238 阅读 · 0 评论 -
204基于顺序存储结构的图书信息表的创建和输出
题目解答:#include<iostream>using namespace std;#include<string>//string类头文件#include<string.h>//memcpy头文件long long MAXSIZE = 1000;struct BOOK { string ISBN; string name; float price;};int main() { BOOK* book = n原创 2021-07-27 10:13:18 · 974 阅读 · 0 评论 -
207基于顺序存储结构的图书信息表的逆序存储
题目答案#include<iostream>using namespace std;#include<string>//string类#include<string.h>//memcpy头文件long long MAXSIZE = 1000;struct BOOK { string ISBN; string name; float price;};void reverse(BOOK book[],int len.原创 2021-07-25 11:20:42 · 1002 阅读 · 0 评论