<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[puppet_pyt的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/puppet_pyt</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; puppet_pyt]]></copyright><item><title><![CDATA[数据结构-AVL树]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/77430018</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/77430018</guid><author>puppet_pyt</author><pubDate>Sun, 20 Aug 2017 16:41:12 +0800</pubDate><description><![CDATA[为什么需要AVL树，以树的结构插入或删除大量随机数据时，有可能会导致树的一边轻一边重， 例如极端情况插入依次123456时，树就与链表无异了，Ologn的查找效率也变成了On;
AVL树的特性：左右子树高度差最大为1，为了维持这个特性，在插入和删除操作时就需要旋转；
旋转规则：当插入位置为对左儿子的左子树进行插入则左单旋，左儿子的右子树时左双旋， 右儿子则镜像；




#inclu]]></description><category></category></item><item><title><![CDATA[数据结构-哈希表]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427623</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427623</guid><author>puppet_pyt</author><pubDate>Sun, 20 Aug 2017 11:51:21 +0800</pubDate><description><![CDATA[采用分离链接法处理冲突，
即当产生冲突时，将以链表的形式将新元素插入原来的元素之后


/***********************************************
     >  Filename: HashTable.cpp
     >  Author:   Pyt
     >  Create:   2017-08-19 10:00:00
***********]]></description><category></category></item><item><title><![CDATA[数据结构-查找二叉树]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427491</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427491</guid><author>puppet_pyt</author><pubDate>Sun, 20 Aug 2017 11:42:53 +0800</pubDate><description><![CDATA[查找二叉树：始终满足任一节点的左儿子小于该节点，右儿子大于该节点，
由于其特性，查找二叉树的中序遍历始终为从小到大；
需要注意的是二叉查找树的删除，有2种策略，在删除节点不多时可以采用懒惰删除，即标记该节点删除而非真正的delete，第二种是当删除节点只有一个儿子或则为叶子节点即没有儿子时，可直接删除并将儿子移至该节点，而当删除节点有左右儿子时将其右子树最小的节点移动至该节点，当然这里并非真正]]></description><category></category></item><item><title><![CDATA[数据结构-二叉堆]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427191</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427191</guid><author>puppet_pyt</author><pubDate>Sun, 20 Aug 2017 11:02:14 +0800</pubDate><description><![CDATA[二叉堆： 堆是一颗完全二叉树， 即除了底层外都被填满，底层从左到右填入的二叉树，注意不是满二叉树；
堆的特性：最大堆，堆顶元素始终为最大值，任一节点的左右儿子则均小于该节点，最小堆则相反
堆由于其特性可以以数组实现并且不大量浪费空间；
当该节点为位置为i时，其左二子位置为2i， 右儿子为2i+1;
root节点应在下标为1的位置；


这里实现了最大堆


/*********]]></description><category></category></item><item><title><![CDATA[数据结构-队列]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427135</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427135</guid><author>puppet_pyt</author><pubDate>Sun, 20 Aug 2017 10:49:30 +0800</pubDate><description><![CDATA[队列：先进先出，以尾插法链表实现，增加一个指针记录链表尾，入队时插入尾部，出队时删除链表头以实现先进先出的特性
/***********************************************
     >  Filename: Queue.cpp
     >  Author:   Pyt
     >  Create:   2017-08-19 14:46:15
******]]></description><category></category></item><item><title><![CDATA[数据结构-栈]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427056</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427056</guid><author>puppet_pyt</author><pubDate>Sun, 20 Aug 2017 10:42:15 +0800</pubDate><description><![CDATA[栈：先进后出
关于其应用值得一提的便是后缀表达式
/***********************************************
     >  Filename: Stack.cpp
     >  Author:   Pyt
     >  Create:   2017-08-19 13:41:43
************************************]]></description><category></category></item><item><title><![CDATA[数据结构-双向链表]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427023</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/77427023</guid><author>puppet_pyt</author><pubDate>Sun, 20 Aug 2017 10:37:09 +0800</pubDate><description><![CDATA[准备把基本数据结构以模板类的形式都敲一遍以准备秋招和PAT考试
/***********************************************
     >  Filename: list.cpp
     >  Author:   Pyt
     >  Create:   2017-08-04 09:36:04
*******************************]]></description><category></category></item><item><title><![CDATA[1034. Head of a Gang (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/72528591</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/72528591</guid><author>puppet_pyt</author><pubDate>Fri, 19 May 2017 14:13:57 +0800</pubDate><description><![CDATA[One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t]]></description><category></category></item><item><title><![CDATA[1099. Build A Binary Search Tree (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71800463</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71800463</guid><author>puppet_pyt</author><pubDate>Sat, 13 May 2017 14:10:09 +0800</pubDate><description><![CDATA[A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:

The left subtree of a node contains only nodes with keys less than the node's key.
The right]]></description><category></category></item><item><title><![CDATA[1095. Cars on Campus (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71625693</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71625693</guid><author>puppet_pyt</author><pubDate>Thu, 11 May 2017 13:57:39 +0800</pubDate><description><![CDATA[Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you a]]></description><category></category></item><item><title><![CDATA[1091. Acute Stroke (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71493209</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71493209</guid><author>puppet_pyt</author><pubDate>Tue, 09 May 2017 19:38:02 +0800</pubDate><description><![CDATA[One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to c]]></description><category></category></item><item><title><![CDATA[1068. Find More Coins (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71423511</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71423511</guid><author>puppet_pyt</author><pubDate>Mon, 08 May 2017 16:13:29 +0800</pubDate><description><![CDATA[Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,]]></description><category></category></item><item><title><![CDATA[1087. All Roads Lead to Rome (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71218978</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71218978</guid><author>puppet_pyt</author><pubDate>Fri, 05 May 2017 18:22:14 +0800</pubDate><description><![CDATA[Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.

Input Specification:

E]]></description><category></category></item><item><title><![CDATA[1018. Public Bike Management (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71173294</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71173294</guid><author>puppet_pyt</author><pubDate>Thu, 04 May 2017 18:37:51 +0800</pubDate><description><![CDATA[There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations in the]]></description><category></category></item><item><title><![CDATA[1076. Forwards on Weibo (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71084065</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71084065</guid><author>puppet_pyt</author><pubDate>Tue, 02 May 2017 17:20:06 +0800</pubDate><description><![CDATA[Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a]]></description><category></category></item><item><title><![CDATA[1075. PAT Judge (25)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71082287</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71082287</guid><author>puppet_pyt</author><pubDate>Tue, 02 May 2017 16:10:35 +0800</pubDate><description><![CDATA[The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist for PAT.

Input Specification:

Each input fil]]></description><category></category></item><item><title><![CDATA[1072. Gas Station (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/71036713</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/71036713</guid><author>puppet_pyt</author><pubDate>Sun, 30 Apr 2017 22:11:30 +0800</pubDate><description><![CDATA[A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the hou]]></description><category></category></item><item><title><![CDATA[1064. Complete Binary Search Tree (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/70851526</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/70851526</guid><author>puppet_pyt</author><pubDate>Thu, 27 Apr 2017 14:06:39 +0800</pubDate><description><![CDATA[A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:


The left subtree of a node contains only nodes with keys less than the node's key.
The righ]]></description><category></category></item><item><title><![CDATA[1057. Stack (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/70851353</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/70851353</guid><author>puppet_pyt</author><pubDate>Thu, 27 Apr 2017 13:51:08 +0800</pubDate><description><![CDATA[Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Po]]></description><category></category></item><item><title><![CDATA[1053. Path of Equal Weight (30)]]></title><link>https://blog.youkuaiyun.com/puppet_pyt/article/details/70850619</link><guid>https://blog.youkuaiyun.com/puppet_pyt/article/details/70850619</guid><author>puppet_pyt</author><pubDate>Thu, 27 Apr 2017 13:38:34 +0800</pubDate><description><![CDATA[Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes
 along the path from R ]]></description><category></category></item></channel></rss>