上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 119 下一页
摘要: 贪心算法的定义:贪心算法是指在对问题求解时,总是做出在当前看来是最好的选择。也就是说,不从整体最优上加以考虑,只做出在某种意义上的局部最优解。贪心算法不是对所有问题都能得到整体最优解,关键是贪心策略的选择,选择的贪心策略必须具备无后效性,即某个状态以前的过程不会影响以后的状态,只与当前状态有关。解题 阅读全文
posted @ 2017-06-09 15:20 鸭子船长 阅读(315) 评论(0) 推荐(0)
摘要: Gas Station There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank 阅读全文
posted @ 2017-06-09 15:03 鸭子船长 阅读(261) 评论(0) 推荐(0)
摘要: There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re 阅读全文
posted @ 2017-06-08 17:56 鸭子船长 阅读(243) 评论(0) 推荐(0)
摘要: HTTP简介 HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于从万维网(WWW:World Wide Web )服务器传输超文本到本地浏览器的传送协议。 HTTP是一个基于TCP/IP通信协议来传递数据(HTML 文件, 图片文件, 查询结果等) 阅读全文
posted @ 2017-06-08 17:04 鸭子船长 阅读(188) 评论(0) 推荐(0)
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull. Follow up:Can you solve it without using extra space? 快 阅读全文
posted @ 2017-06-07 23:09 鸭子船长 阅读(364) 评论(0) 推荐(0)
摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 若在while开始时判断fast==slow,会出现误判,即第一次循环时fast 阅读全文
posted @ 2017-06-07 23:02 鸭子船长 阅读(200) 评论(0) 推荐(0)
摘要: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For 阅读全文
posted @ 2017-06-07 22:53 鸭子船长 阅读(158) 评论(0) 推荐(0)
摘要: 上面分析了 根据这张图 推倒出 数学公式。 刚接触 不能一下弄明白。下面结合上面文章的分析。仔细推倒一下 , 一般设置 快指针 速度是 慢指针的2倍。及 快指针每次遍历两个指针, 慢指针每次遍历1个指针。 假设上图 快慢指针 在E点相遇,那 相遇点离循环节点D 之间距离是X. 头结点A 离循环节点D 阅读全文
posted @ 2017-06-07 17:35 鸭子船长 阅读(595) 评论(0) 推荐(0)
摘要: Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree{1,#,2,3}, return[1,2,3]. Note: Recursive soluti 阅读全文
posted @ 2017-06-07 17:03 鸭子船长 阅读(215) 评论(0) 推荐(0)
摘要: Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree{1,#,2,3}, return[3,2,1]. Note: Recursive solut 阅读全文
posted @ 2017-06-07 16:52 鸭子船长 阅读(270) 评论(0) 推荐(0)
上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 119 下一页