摘要: 剑指 offer 58 题目 输入一个英文句子,翻转句子中单词的顺序,但单词内字符的顺序不变。为简单起见,标点符号和普通字母一样处理。例如输入字符串"I am a student. ",则输出"student. a am I"。 无空格字符构成一个单词。 输入字符串可以在前面或者后面包含多余的空格, 阅读全文
posted @ 2020-12-23 22:58 _一只土拨鼠 阅读(82) 评论(0) 推荐(0)
摘要: 简介 要包含头文件 #include <string> 可以用cin和cout输入输出 可以用数组表示法来访问存储在string对象里的字符串 string str = "apple"; cin >> str; cout << str; cout << str[2]; 使用 拼接 str += "b 阅读全文
posted @ 2020-12-23 17:48 _一只土拨鼠 阅读(42) 评论(0) 推荐(0)
摘要: 谷歌pagerank算法 数据描述 Directed graph (each unordered pair of nodes is saved once): web-Google.txt Webgraph from the Google programming contest, 2002 Nodes 阅读全文
posted @ 2020-12-23 14:17 _一只土拨鼠 阅读(179) 评论(0) 推荐(0)
摘要: 读取csv文件(movie数据集) import pandas as pd df_rating = pd.DataFrame(pd.read_csv('ratings.csv')) for index, row in df_rating.iterrows(): userId = row["userI 阅读全文
posted @ 2020-12-23 14:08 _一只土拨鼠 阅读(111) 评论(0) 推荐(0)
摘要: 1. 递归三大要素 明确函数的功能 这个函数到底想要干嘛 寻找递归结束的条件 递归会在函数内部不断地调用函数本身,如果不指定终止条件,它就会一直执行下去 找出当参数为啥时,递归结束,之后直接把结果返回,请注意,这个时候我们必须能根据这个参数的值,能够直接知道函数的结果是什么 // 算 n 的阶乘(假 阅读全文
posted @ 2020-12-23 12:45 _一只土拨鼠 阅读(110) 评论(0) 推荐(0)