自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

TRS_07170的博客

Living In My Time Zone

  • 博客(106)
  • 收藏
  • 关注

原创 Python MergeSort

MergeSortdef merge(numbers, i, j, k): merged_size = k - i + 1 # Size of merged partition merged_numbers = [0] * merged_size # Dynamically allocates temporary array # for merged numbers

2021-04-27 16:27:38 140

原创 Python模板 Quicksort

Quicksortdef partition(numbers, start_index, end_index): # Select the middle value as the pivot. midpoint = start_index + (end_index - start_index) // 2 pivot = numbers[midpoint] # "low" and "high" start at the ends of the list segme

2021-04-25 12:54:54 150

原创 Python模板 Heaps

Heapsclass MaxHeap: def __init__(self): self.heap_array = [] def percolate_up(self, node_index): while node_index > 0: # compute the parent node's index parent_index = (node_index - 1) // 2

2021-04-25 12:33:38 173 1

原创 Python模板 AVL Tree

AVL Treeclass Node: # Constructor with a key parameter creates the Node object. def __init__(self, key): self.key = key self.parent = None self.left = None self.right = None self.height = 0 #

2021-04-25 12:30:59 115

原创 Python模板 Binary Search Tree

Binary Search Treeclass Node: # Constructor assigns the given key, with left and right # children assigned with None. def __init__(self, key): self.key = key self.left = None self.right = Noneclass BinarySearchTree

2021-04-25 12:27:07 199

原创 小小学习成果:Python爬虫爬取国务院最新政策

当作是这三周实习学到的一点小成果吧。还有很多不会的,要继续加油!写了一个初级爬虫,简单了解了一下,结合一下学到的整理数据的方法。任务就是爬取国务院的最新政策:代码:import requestsimport refrom bs4 import BeautifulSoupfrom pandas import DataFrameurl = 'http://www.gov.cn/zhengce/zuixin.htm'UA = 'Mozilla/5.0 (Windows NT 10.0

2021-01-29 14:36:14 5965 10

原创 焱飞科技实习日志 Day9&10

成为打工人的第九、第十天这两天就没有再往前学,而是停下来复习、夯实一下之前numpy和pandas库的内容。实在是太多了。。。不过今天离开的时候和leader交流了一下,leader说不用刻意去复习,因为你总是不可能把所有的东西都装进脑子里。而是当你需要用到它的时候再去细致的学习,现在脑子里就只需要有个大概的印象。这和我大学计算机老师说的一模一样:程序员具有的一项重要技能就是活用搜索引擎233333。所以这周剩下的三天就要开始有点小作业练手了。明天是去试着自己搞搞爬虫(好兴奋,毕竟久仰爬虫的大名了,马上

2021-01-26 22:00:05 202 4

原创 《利用python进行数据分析》第4章学习笔记(2)

第4章 NumPy基础:数组和矢量计算(Part1)NumPy的ndarray:一种多维数组对象基本的索引和切片一维数组一维数组的索引和切片方式跟Python列表的差不多:#codedata = np.arange(10)print(data[4:7])#output[4 5 6]比较有趣的是数组的赋值操作。当你将一个标量值赋值给一个切片时(如data[4 : 7] = 10),该值会自动传播到整个选区,这也是后面板块会讲到的广播:#codedata = n.

2021-01-25 16:24:24 174

原创 《利用python进行数据分析》第4章学习笔记(1)

第4章 NumPy基础:数组和矢量计算NumPy的ndarray:一种多维数组对象NumPy最重要的一个特点就是其N维数组对象(即ndarray)。该对象是一个快速而灵活的大数据容器集。你可以利用这种数组对整块数据执行一些数学运算,其语法跟标量元素之间的运算一样:In [4]: dataOut[4]: array([[1, 3, 4], [6, 2, 5]])In [5]: data + 10Out[5]: array([[11, 13, 14], .

2021-01-25 11:05:42 326

原创 焱飞科技实习日志 Day7&8

成为打工人的第七、第八天这周实际上只打了三天工。。。因为之后都陪家人出去旅游了。但由于各种各样的原因,每天都忘记了写日志,所以就这周回家了囤到一起写。这两天发现学的东西太多了,有点吸收不过来。索性停下来,总结前面学的所有东西。目前总结了文件输入输出那个板块,numpy和pandas还没有总结完。只能说自己再梳理一遍,真的会清晰很多。下一周结束,打工生活就告一段落了,因为学校2月1日就开学了。又回归到zoom university了23333。大概就是这样了,希望下周可以能够有任务给我小练一下手吧

2021-01-23 12:25:51 177 2

原创 《利用python进行数据分析》第6章学习笔记(2)

第6章 数据加载、存储与文件格式(Part2)to_csv方法利用DataFrame中的to_csv方法,我们可以将数据写到一个以逗号分隔的文件中。,something,a,b,c,d,message0,one,1,2,3.0,4,1,two,5,6,,8,world2,three,9,10,11.0,12,foo我们读入如上csv文件:file = 'ex5.csv'data = pd.read_csv(file, index_col = 0)将储存数据的Dat..

2021-01-19 17:14:35 355 1

原创 《利用python进行数据分析》第6章学习笔记(1)

第6章 数据加载、存储与文件格式(Part1)目录第6章 数据加载、存储与文件格式csv文件读入pandas中的解析函数:read_csv读入DataFrameread_table读入DataFrameread_csv函数参数header参数names参数index_col参数异形文件处理skiprows参数缺失值处理na_values参数read_csv和read_table常用参数汇总逐块读取文本nrows参数chunksize参数

2021-01-19 11:58:44 177

原创 焱飞科技实习日志 Day6

成为打工人的第六天本来以为学完了pandas和numpy就已经差不多可以上手了,但好像这本书连一半都还没有讲到。还有好多东西要学啊。感觉python和c++完全不同的地方在于python的工具太多样化了,甚至出现了很多功能重复的工具,让我眼花缭乱。我手上这本书由于不是最新版,很多函数都因为版本的更替被弃用了,导致我经常很懵逼在3.8这个版本要拿什么函数代替书上的函数。好在有大佬把这本书所有的版本更替导致的错误都整理了出来,我不得不orz。这里把大佬文章的链接贴出来:《利用python进行数据分析》常见问

2021-01-18 22:47:08 214

原创 焱飞科技实习日志 Day5

成为打工人的第五天好家伙,成为打工人的第一双休让我快乐昏了头,直接忘记写总结了23333。周六来补上。这周还是按照我的最初计划在进行,成功一周的时间学完了基础的numpy和pandas两个重要的库。但貌似这两个库并不足以支撑我和同事们一起做项目,还有很多很多东西要学,例如不同类型的文件的读取方式等等。书的后面还有很多的实际应用,还要借这些例子熟悉numpy和pandas的运用。看来是任重而道远啊。值得一提的是,昨天和他们一起参加了每月两次(月中和月末)的技术分享会,会上大家一起分享觉得值得学习的

2021-01-16 13:19:33 220 3

原创 焱飞科技实习日志 Day4

成为打工人的第四天今天是摸鱼的一天。。。。pandas学得我脑壳痛,边摸鱼边学,进度比较缓慢。恰好今儿KPL冬冠在打比赛,所以就。。。今儿感觉稍微改变了一下学习策略,不求学的有多快,就把学到的每个函数,每个方法都弄明白,多搜点博客和例子来练练手,反而心里踏实一些。所以今天的学习内容就还是pandas,书的P137 - P156。这短短的十来页,让我来回翻书翻了无数次,可见之前的内容掌握还是不牢靠。学完这两个库之后,还需要多找点实际的例子来综合练习一下。今天比较开心的事情是,我发现程序员小哥哥小姐

2021-01-14 21:08:28 255

原创 焱飞科技实习日志 Day3

成为打工人的第三天第三天学下来,只能说pandas远远超过了我的预期。我太低估它了。。。本来觉得numpy里面的操作已经够多了,结果pandas里面更是让人应接不暇。不过还好昨天定任务的时候比较保守(23333),算是完成了昨天的计划。pandas这一章一共四十七页,今天一个下午看了十六页,还算不错。看这本书给我的感觉就像我学英文在抱着字典读。一个操作跟着一个操作,全靠自己慢慢消化。今天下午最后一个小时实在是顶不住了,脑子的运存已经满了,就选择了休(mo)息(yu)。今天的学习内容为:结束了对n

2021-01-13 20:12:29 158

原创 焱飞科技实习日志 Day2

成为打工人的第二天第二天的学习,还是出了点儿差错。。。昨天没仔细跟leader商量,今儿去学了一早上leader告诉我只用看numpy和pandas那两章就好了。。。巧了我刚好把前面的看完。其实今儿的工作量也是超乎了预期(应该说是低估了这本书里与我无关的内容的量)。所以总结下来,今儿的学习内容主要分为:通过一、二章了解了数据分析主要是干嘛的; 通过第三章了解IPython(虽然这对我暂时没什么帮助,但有助于我加深对Python的整体理解); 第四章还没看完,看到了P116,主要讲解numpy

2021-01-12 21:54:08 167

原创 焱飞科技实习日志 Day1

成为打工人的第一天从今天起就在成都焱飞科技开始实习生活了。当然,由于本人刚大一,确实没什么真才实学,就只能去涨涨姿势,也感谢贵公司肯收留我。好在大家都很友好,我也算是渐渐融入进新环境了(虽然作为究极混子还是缩在角落不敢说话,最开始连问题都不敢问23333。第一天确实没干什么事儿,我的leader也明白我离真正帮得上忙还有一些距离,就先找给我了一本Python的基础教材(虽然我已经学完大部分基础了,但一开始我是真的不敢说话啊)。就这样闷着头学到了下午,也算是夯实了一下基础,还是学到了很多Python里

2021-01-11 20:50:56 187

原创 2021-01-09 USACO Hamming Codes

Given N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the codewords is at least Hamming distance of D (1 <= D <= 7) away from each of the other codewords.The Hamming distance

2021-01-09 16:06:57 109

原创 2021-01-09 USACO Healthy Holsteins

Farmer John prides himself on having the healthiest dairy cows in the world. He knows the vitamin content for one scoop of each feed type and the minimum daily vitamin requirement for his cows. Help Farmer John feed the cows so they stay healthy while mini

2021-01-09 12:14:19 153

原创 2021-01-07 USACO Sorting a Three-Valued Sequence

Sorting is one of the most frequently performed computational tasks. Consider the special sorting problem in which the records to be sorted have at mostthreedifferent key values. This happens for instance when we sort medalists of a competition according..

2021-01-07 17:39:40 100

原创 2021-01-07 USACO Ordered Fractions

Consider the set of all reduced fractions between 0 and 1 inclusive with denominators less than or equal to N.Here is the set when N = 5:0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1Write a program that, given an integer N between 1 and 160 inclusive

2021-01-07 16:15:30 166 1

原创 2021-01-07 USACO The Castle

In a stroke of luck almost beyond imagination, Farmer John was sent a ticket to the Irish Sweepstakes (really a lottery) for his birthday. This ticket turned out to have only the winning number for the lottery! Farmer John won a fabulous castle in the Iris

2021-01-07 15:06:20 92

原创 2021-01-06 USACO Superprime Rib

Butchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across them, one by one, by FJ and the USDA. Farmer John ensures that a purchaser of his prime ribs gets really prime ribs bec

2021-01-06 17:49:20 129

原创 2021-01-06 USACO Prime Palindromes

The number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime palindromes in the range of two supplied numbers a and b (5 <= a < b &

2021-01-06 15:55:13 81

原创 2021-01-06 USACO Number Triangles

Consider the number triangle shown below. Write a program that calculates the highest sum of numbers that can be passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down

2021-01-06 12:19:20 127

原创 2021-01-05 USACO Mother‘s Milk

Farmer John has three milking buckets of capacity A, B, and C liters. Each of the numbers A, B, and C is an integer from 1 through 20, inclusive. Initially, buckets A and B are empty while bucket C is full of milk. Sometimes, FJ pours milk from one bucket

2021-01-05 20:46:00 165

原创 2021-01-05 USACO Arithmetic Progressions

An arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb where n=0, 1, 2, 3, ... . For this problem, a is a non-negative integer and b is a positive integer.Write a program that finds all arithmetic progressions of length n in the set

2021-01-05 17:16:29 134

原创 2021-01-05 USACO Ski Course Design

Farmer John has N hills on his farm (1 <= N <= 1,000), each with an integer elevation in the range 0 .. 100. In the winter, since there is abundant snow on these hills, FJ routinely operates a ski training camp.Unfortunately, FJ has just found out

2021-01-05 11:39:54 142

原创 2021-01-04 USACO Wormholes

Farmer John's hobby of conducting high-energy physics experiments on weekends has backfired, causing N wormholes (2 <= N <= 12, N even) to materialize on his farm, each located at a distinct point on the 2D map of his farm (the x,y coordinates are bo

2021-01-04 11:58:15 129

原创 2021-01-02 USACO Combination Lock

Farmer John's cows keep escaping from his farm and causing mischief. To try and prevent them from leaving, he purchases a fancy combination lock to keep his cows from opening the pasture gate.Knowing that his cows are quite clever, Farmer John wants to m

2021-01-02 17:04:51 92

原创 2021-01-02 USACO Prime Cryptarithm

(This poorly named task has nothing to do with prime numbers or even, really, prime digits. Sorry 'bout that.)A cryptarithm is usually presented as a pencil-and-paper task in which the solver is required to substitute a digit for each of the asterisks (o

2021-01-02 15:39:08 129

原创 2021-01-02 USACO Barn Repair

It was a dark and stormy night that ripped the roof and gates off the stalls that hold Farmer John's cows. Happily, many of the cows were on vacation, so the barn was not completely full.The cows spend the night in stalls that are arranged adjacent to ea

2021-01-02 12:55:10 83

原创 2021-01-01 USACO Mixing Milk

The Merry Milk Makers company buys milk from farmers, packages it into attractive 1- and 2-Unit bottles, and then sells that milk to grocery stores so we can each start our day with delicious cereal and milk.Since milk packaging is such a difficult busin

2021-01-01 23:33:01 202

原创 2021-01-01 USACO Dual Palindromes

A number that reads the same from right to left as when read from left to right is called a palindrome. The number 12321 is a palindrome; the number 77778 is not. Of course, palindromes have neither leading nor trailing zeroes, so 0220 is not a palindrome.

2021-01-01 20:17:07 104

原创 2021-01-01 USACO Palindromic Squares

Palindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.Given a number base B (2 <= B <= 20 base 10), print all the integers N (1 <= N <= 300 base 10) such that the square of N is palindromic

2021-01-01 19:46:16 86

原创 2020-12-31 USACO Name That Number

Among the large Wisconsin cattle ranchers, it is customary to brand cows with serial numbers to please the Accounting Department. The cow hands don't appreciate the advantage of this filing system, though, and wish to call the members of their herd by a pl

2020-12-31 17:29:01 140

原创 2020-12-31 USACO Transformations

A square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into another square pattern. Write a program that will recognize the minimum transformation that has been applied to the original pattern given the following li

2020-12-31 14:38:37 109

原创 2020-12-31 重新学习C++ 之 指针

用指针写的链表从刚开始就没有彻底理解链表的原理,所以一直就是背的板子。直到今天学了指针,拿指针写链表,才觉得很透彻。指针的思路真的比数组清晰很多。#include<cstdio>#include<iostream>#include<cstdlib>using namespace std;struct Node { int value; Node* next;}; struct List { Node* head; Node* last;

2020-12-31 11:49:43 69

原创 2020-12-30 USACO Milking Cows

Three farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (measured in seconds after 5 am) and ends at time 1000. The second farmer begins at time 700 and ends at time 1200. The th

2020-12-31 11:46:52 74

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除