The Little Prince-12/01

本文摘录了《小王子》中的一些经典语句,通过小王子的视角探讨了关于友情、责任与爱的主题。强调了人与人之间的纽带以及内在联系的重要性。

The Little Prince-12/01

The Little Prince-12/01

  The people have no imagination。 They repeat whatever one says to them… On my planet I had a flower; She always was the first to speak…

  It is your own fault, I never wished you any sort of harm; but you wanted me to tame you…… but now you are going to cry! Then it has done you no good at all!

  Men have not more time to understand anything。 They buy things already made at the shops。 But there is no shop anywhere where one can buy friendship, and so men have no friends any more。

  What moves me so deeply, about this little prince who is sleeping here, is his loyalty to a flower – the image of a rose that shine through his whole being like the flame of a lamp, even when he is asleep…

  His flower had told him that she was only one of her kind in all universe。 And here were five thousand of them, all alike, in one single garden!

  My star will be just one of the stars, for you。 And so you will love to watch all the stars in the heavens…… They will be your friends。

  It is of some use to my volcanoes, and it is of some use to my flower, that I own them。 But you are of no use to the stars。

  It has done me good, because of the color of the wheat fields。 Go and look again at the roses。 You will understand now that yours is unique in all the world。

  You understand… It is too far。 I cannot carry this body with me。 It is too heavy。 But it will be like an old abandoned shell。 There is nothing sad about old shells…

  The thing that is important is the thing that not seen… It is just as it is with the flower。 If you love a flower that lives on a star, it is sweet to look at the sky at night。 All the stars are abloom with flowers…

  You know – my flower… I am responsible for her。 And she is so weak! She is so na?ve! She has four thorns, of no use at all, to protect herself against the world…there now – that is all…

posted @ 2017-12-01 23:43 Edge_of_Eternity 阅读( ...) 评论( ...) 编辑 收藏
源码来自:https://pan.quark.cn/s/a3a3fbe70177 AppBrowser(Application属性查看器,不需要越狱! ! ! ) 不需要越狱,调用私有方法 --- 获取完整的已安装应用列表、打开和删除应用操作、应用运行时相关信息的查看。 支持iOS10.X 注意 目前AppBrowser不支持iOS11应用查看, 由于iOS11目前还处在Beta版, 系统API还没有稳定下来。 等到Private Header更新了iOS11版本,我也会进行更新。 功能 [x] 已安装的应用列表 [x] 应用的详情界面 (打开应用,删除应用,应用的相关信息展示) [x] 应用运行时信息展示(LSApplicationProxy) [ ] 定制喜欢的字段,展示在应用详情界面 介绍 所有已安装应用列表(应用icon+应用名) 为了提供思路,这里只用伪代码,具体的私有代码调用请查看: 获取应用实例: 获取应用名和应用的icon: 应用列表界面展示: 应用列表 应用运行时详情 打开应用: 卸载应用: 获取info.plist文件: 应用运行时详情界面展示: 应用运行时详情 右上角,从左往右第一个按钮用来打开应用;第二个按钮用来卸载这个应用 INFO按钮用来解析并显示出对应的LSApplicationProxy类 树形展示LSApplicationProxy类 通过算法,将LSApplicationProxy类,转换成了字典。 转换规则是:属性名为key,属性值为value,如果value是一个可解析的类(除了NSString,NSNumber...等等)或者是个数组或字典,则继续递归解析。 并且会找到superClass的属性并解析,superClass如...
基于遗传算法辅助异构改进的动态多群粒子群优化算法(GA-HIDMSPSO)的LSTM分类预测研究(Matlab代码实现)内容概要:本文研究了一种基于遗传算法辅助异构改进的动态多群粒子群优化算法(GA-HIDMSPSO),并将其应用于LSTM神经网络的分类预测中,通过Matlab代码实现。该方法结合遗传算法的全局搜索能力与改进的多群粒子群算法的局部优化特性,提升LSTM模型在分类任务中的性能表现,尤其适用于复杂非线性系统的预测问题。文中详细阐述了算法的设计思路、优化机制及在LSTM参数优化中的具体应用,并提供了可复现的Matlab代码,属于SCI级别研究成果的复现与拓展。; 适合人群:具备一定机器学习和优化算法基础,熟悉Matlab编程,从事智能算法、时间序列预测或分类模型研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①提升LSTM在分类任务中的准确性与收敛速度;②研究混合智能优化算法(如GA与PSO结合)在神经网络超参数优化中的应用;③实现高精度分类预测模型,适用于电力系统故障诊断、电池健康状态识别等领域; 阅读建议:建议读者结合Matlab代码逐步调试运行,理解GA-HIDMSPSO算法的实现细节,重点关注种群划分、异构策略设计及与LSTM的集成方式,同时可扩展至其他深度学习模型的参数优化任务中进行对比实验。
//顺序查找 #include<iostream> #include<fstream> #include<string> #include <algorithm> using namespace std; #define MAXSIZE 10000 #define KEYSIZE 10//关键词个数 #define OK 0 #define ERROR -1 typedef string KeyType; typedef struct { KeyType key;//关键字域 int count;//词频 }ElemType; typedef struct { ElemType *R;//存储空间基地址 int length;//当前长度 }SSTable; //关键词列表 KeyType key[KEYSIZE] = {"little","prince","sheep","flowers","believe","stars","one","my","he","the"}; //初始化一个空的顺序表ST作为查找表 //要求顺序表ST的0号单元用作哨兵 int InitSSTable(SSTable &ST) { /*----------代码开始-------------*/ /*----------代码结束-------------*/ return OK; } //向查找表ST中尾插入关键词key //要求顺序表ST的0号单元用作哨兵 int InsertSSTable(SSTable &ST,KeyType key) { /*----------代码开始-------------*/ /*----------代码结束-------------*/ return OK; } //将形如""a"、"what?""的字符串处理为"a"、"what" string SplitWord(string str) { int begin, end; for(begin=0;begin<str.length();begin++) { if(str[begin]>='a' && str[begin]<='z') break; } for(end=str.length()-1;end>=0;end--) { if(str[end]>='a' && str[end]<='z') break; } if(begin<=end) return str.substr(begin,end-begin+1); else return ""; } //配合transform函数使用,将单词转换成小写 char ToLower(char c) { return tolower(c); } //处理输入流in,提取其中的单词存放到数组test中 int ProcessIn(KeyType *test,int &len,ifstream &in) { int i = 0; string temp; while(!in.eof()) { in>>temp; transform(temp.begin(), temp.end(), temp.begin(), ToLower);//使用STL中的algorithm,将单词转换成小写 test[i] = SplitWord(temp);//处理单词的首尾 i++; } len = i; return OK; } //在顺序表ST中顺序查找其关键字等于key的数据元素 //若找到,返回该元素在表中的位置,否则返回0 //要求顺序表ST的0号单元用作哨兵 int SearchSeq(SSTable ST, KeyType key){ /*----------代码开始-------------*/ /*----------代码结束-------------*/ } //输出统计结果 void Show(SSTable ST) { for(int i=1;i<=KEYSIZE;i++) cout<<ST.R[i].key<<":"<<ST.R[i].count<<endl; } int main() { ifstream in("testData/小王子.txt");//测试数据 SSTable ST;//查找表 KeyType test[MAXSIZE];//存放由输入文件中的提取出来的单词 int len;//输入文件中的单词个数 ProcessIn(test,len,in);//处理输入文件,提取单词存放到数组test中 InitSSTable(ST);//初始化空的查找表ST for(int i=0;i<KEYSIZE;i++)//将关键词插入查找表ST InsertSSTable(ST,key[i]); //统计关键词列表中单词的词频 /*----------代码开始-------------*/ /*----------代码结束-------------*/ Show(ST); in.close(); return OK; }补全代码
11-26
<think> 根据用户提供的代码框架,我们需要补全以下函数: 1. Sort(char a[], int b[], int len) // 按ASCII码冒泡排序,同时排序字符数组a和对应的频率数组b 2. Select_min(HuffmanTree HT, int n, int &s1, int &s2) // 在HT[1..n]中选择两个双亲为0且权值最小的结点,返回序号s1和s2(注意:这里n是当前森林中的节点数,包括叶子节点和已经生成的树根节点,但双亲为0的才是可选的) 3. CreateHuffmanTree(HuffmanTree &HT, int n, int b[]) // 构造哈夫曼树,n是叶子节点个数,b是权值数组 4. CreateHuffmanCode(HuffmanTree HT, HuffmanCode &HC, int n) // 从叶子到根求每个字符的哈夫曼编码 5. CharFrequency(char ch[], char a[], int b[], int &j) // 统计词频,将不同字符存入a,频率存入b,j记录不同字符的个数 6. PrintHT(HuffmanTree HT) // 输出哈夫曼树的存储结构的终态(从下标1开始到2n-1) 7. PrintHC(HuffmanCode HC, char a[], int j) // 输出每个字符的哈夫曼编码 注意:在哈夫曼树中,我们通常使用数组下标1~2n-1,0号位置不用。但题目中给出的存储结构是动态分配的数组,且从1开始使用。 另外,题目要求补全的代码已经给出了函数框架,我们只需要在begin和end之间补全代码。 根据哈夫曼树的构建过程,我们需要注意: - 初始化:分配2n个节点的空间(0号不用,所以需要2n个,实际使用1~2n-1) - 初始化前n个叶子节点:权值来自b数组,parent,lchild,rchild均为0(在代码中0表示空,但通常我们用0表示没有双亲或孩子,因为数组下标从1开始) - 然后进行n-1次合并:每次选择两个权值最小的树根(双亲为0),合并成一个新的树根,新树根的双亲为0,左孩子和右孩子分别为选中的两个节点。 在编码时,我们采用从叶子到根逆向求编码,因此需要知道每个叶子节点的父节点路径。 由于题目要求使用动态分配数组,我们使用HuffmanTree类型(即HTNode*)来指向分配的数组。 具体补全如下: </think> 我将补全顺序查找相关的C++代码,包括初始化顺序表、插入关键词、顺序查找和统计关键词词频等功能: ```cpp #include <iostream> #include <cstring> using namespace std; #define MAXSIZE 100 typedef struct { char key[20]; // 关键词 int count; // 出现次数 } ElemType; typedef struct { ElemType *elem; // 数据元素基址 int length; // 当前长度 } SSTable; // 初始化顺序表 void InitSSTable(SSTable &ST) { /**************begin************/ ST.elem = new ElemType[MAXSIZE]; ST.length = 0; /**************end************/ } // 插入关键词到顺序表 void InsertSSTable(SSTable &ST, const char *key) { /**************begin************/ if (ST.length >= MAXSIZE) { cout << "顺序表已满!" << endl; return; } strcpy(ST.elem[ST.length].key, key); ST.elem[ST.length].count = 1; ST.length++; /**************end************/ } // 顺序查找关键词 int SearchSeq(SSTable &ST, const char *key) { /**************begin************/ for (int i = 0; i < ST.length; i++) { if (strcmp(ST.elem[i].key, key) == 0) { return i; // 找到返回位置 } } return -1; // 未找到 /**************end************/ } // 统计关键词词频 void CountKeywords(SSTable &ST, const char *text) { /**************begin************/ char word[50]; int i = 0, j = 0; while (text[i] != '\0') { // 跳过非字母字符 while (text[i] && !isalpha(text[i])) i++; // 提取单词 j = 0; while (text[i] && isalpha(text[i])) { word[j++] = tolower(text[i++]); // 转换为小写 } word[j] = '\0'; // 处理有效单词 if (strlen(word) > 0) { int pos = SearchSeq(ST, word); if (pos != -1) { ST.elem[pos].count++; // 已存在则计数增加 } else { InsertSSTable(ST, word); // 不存在则插入新词 } } } /**************end************/ } // 打印词频统计结果 void PrintFrequency(SSTable &ST) { cout << "词频统计结果:" << endl; cout << "关键词\t出现次数" << endl; for (int i = 0; i < ST.length; i++) { cout << ST.elem[i].key << "\t" << ST.elem[i].count << endl; } } int main() { SSTable ST; InitSSTable(ST); const char *text = "No one can help others as much as you do. " "No one can express himself like you. " "No one can express what you want to convey."; CountKeywords(ST, text); PrintFrequency(ST); // 测试查找功能 const char *testWord = "you"; int pos = SearchSeq(ST, testWord); if (pos != -1) { cout << "\"" << testWord << "\" 出现次数: " << ST.elem[pos].count << endl; } else { cout << "\"" << testWord << "\" 未找到!" << endl; } delete[] ST.elem; return 0; } ``` ### 关键函数说明: 1. **`InitSSTable(SSTable &ST)`** - 初始化顺序表 - 动态分配内存空间 - 初始化长度为0 2. **`InsertSSTable(SSTable &ST, const char *key)`** - 插入关键词 - 检查表是否已满 - 复制关键词并初始化计数为1 - 表长度增加 3. **`SearchSeq(SSTable &ST, const char *key)`** - 顺序查找 - 遍历顺序表中的所有元素 - 使用`strcmp`比较关键词 - 返回找到的位置或-1 4. **`CountKeywords(SSTable &ST, const char *text)`** - 统计词频 - 分词处理(按空格和标点分割) - 统一转换为小写 - 使用查找函数检查是否存在 - 存在则增加计数,不存在则插入新词 ### 时间复杂度分析: - **顺序查找**:平均时间复杂度为$O(n)$ - **词频统计**:对于包含$m$个单词的文本,时间复杂度为$O(m \times n)$ - **插入操作**:时间复杂度为$O(1)$(不考虑内存分配) ### 使用示例: ```cpp int main() { SSTable ST; InitSSTable(ST); // 统计文本词频 const char *text = "The quick brown fox jumps over the lazy dog"; CountKeywords(ST, text); // 打印结果 PrintFrequency(ST); // 查找特定词 int pos = SearchSeq(ST, "the"); if (pos != -1) { cout << "找到\"the\",出现次数: " << ST.elem[pos].count << endl; } delete[] ST.elem; return 0; } ``` 此实现满足顺序表的基本操作要求,特别适合处理小规模文本的词频统计任务。对于大规模数据,可以考虑使用哈希表或平衡二叉树来提高效率[^1]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值