07 2015 档案

摘要:Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.需考虑3类特殊情况:1、x1=x2,斜率无穷大;2、x1=x2,y1=y2,相同点也要计数,当计算最终结果... 阅读全文
posted @ 2015-07-31 16:52 鸭子船长 阅读(142) 评论(0) 推荐(0) 编辑
摘要:转自:http://blog.csdn.net/com_stu_zhang/article/details/7233761 一、基本概念 在计算机科学中,分治法是一种很重要的算法。字面上的解释是“分而治之”,就是把一个复杂的问题分成两个或更多的相同或相似的子问题,再把子问题分成更小的子问题……直到最 阅读全文
posted @ 2015-07-31 15:09 鸭子船长 阅读(320) 评论(0) 推荐(0) 编辑
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
posted @ 2015-07-31 15:04 鸭子船长 阅读(114) 评论(0) 推荐(0) 编辑
摘要:Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2015-07-31 14:36 鸭子船长 阅读(159) 评论(0) 推荐(0) 编辑
摘要:转自:http://bbs.byr.cn/#!article/Job/1586350?p=2发信人: annasui (舞翎狐), 信区: Job标题: 【蕾姐说】聊聊贼拉火的户口发信站: 北邮人论坛 (Fri Jul 11 17:49:29 2014), 站内蕾姐是个逗儿逼的互联网公司HR,注意,... 阅读全文
posted @ 2015-07-31 12:46 鸭子船长 阅读(250) 评论(0) 推荐(0) 编辑
摘要:转自:http://blog.csdn.net/truexf/article/details/17303263一、vectorvector采用一段连续的内存来存储其元素,向vector添加元素的时候,如果容量不足,vector便会重新malloc一段更大的内存,然后把原内存中的数据memcpy到新的... 阅读全文
posted @ 2015-07-31 09:53 鸭子船长 阅读(2222) 评论(0) 推荐(0) 编辑
摘要:The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a... 阅读全文
posted @ 2015-07-30 16:37 鸭子船长 阅读(229) 评论(0) 推荐(0) 编辑
摘要:转自:http://blog.csdn.net/morewindows/article/details/6709644/堆排序与快速排序,归并排序一样都是时间复杂度为O(N*logN)的几种常见排序方法。学习堆排序前,先讲解下什么是数据结构中的二叉堆。二叉堆的定义二叉堆是完全二叉树或者是近似完全二叉... 阅读全文
posted @ 2015-07-30 16:01 鸭子船长 阅读(164) 评论(0) 推荐(0) 编辑
摘要:转自:http://www.cnblogs.com/bourbon/archive/2011/08/26/2152158.html前言前段时间,我的一位钟情.net的童鞋在编写一套“教务管理系统”的时候,遇到了一个问题。因为系统中包含学生的成绩排序,而大学英语作为公共课有非常多人考试。这使得大学英语... 阅读全文
posted @ 2015-07-30 15:58 鸭子船长 阅读(173) 评论(0) 推荐(0) 编辑
摘要:转自http://www.cnblogs.com/bourbon/archive/2011/08/23/2151044.html前言和分治法一样,动态规划(dynamic programing)是通过组合子问题的解而解决整个问题的。注意这里的programing翻译成立规划而不是编程。维基百科上写道... 阅读全文
posted @ 2015-07-30 14:14 鸭子船长 阅读(241) 评论(0) 推荐(0) 编辑
摘要:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single 阅读全文
posted @ 2015-07-29 16:43 鸭子船长 阅读(156) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
posted @ 2015-07-29 16:17 鸭子船长 阅读(138) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[i] = nums[j]and the d... 阅读全文
posted @ 2015-07-29 16:13 鸭子船长 阅读(145) 评论(0) 推荐(0) 编辑
摘要:There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should... 阅读全文
posted @ 2015-07-29 15:40 鸭子船长 阅读(109) 评论(0) 推荐(0) 编辑
摘要:转自http://blog.sina.com.cn/s/blog_9f1c0931010180cy.html Vectors vector是C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。vector之所以被认为是一个容器,是因为它能够像容器一样存放各种类 阅读全文
posted @ 2015-07-29 14:56 鸭子船长 阅读(454) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2015-07-29 10:39 鸭子船长 阅读(169) 评论(0) 推荐(0) 编辑
摘要:A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you aregiven... 阅读全文
posted @ 2015-07-29 00:42 鸭子船长 阅读(179) 评论(0) 推荐(0) 编辑
摘要:转自:http://blog.csdn.net/zzzmmmkkk/article/details/4266888/所以自己总结了一下,首先看sort函数见下表:函数名功能描述sort对给定区间所有元素进行排序stable_sort对给定区间所有元素进行稳定排序partial_sort对给定区间所有... 阅读全文
posted @ 2015-07-28 15:12 鸭子船长 阅读(552) 评论(0) 推荐(0) 编辑
摘要:转自http://blog.csdn.net/orbit/article/details/7368996二、扫描线算法(Scan-LineFilling) 扫描线算法适合对矢量图形进行区域填充,只需要直到多边形区域的几何位置,不需要指定种子点,适合计算机自动进行图形处理的场合使用,比如电脑游戏和三维... 阅读全文
posted @ 2015-07-28 14:26 鸭子船长 阅读(2280) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find out whether there are two distinct indicesiandjin the array such that the difference betweennums[i]andnums[j]is at mo... 阅读全文
posted @ 2015-07-28 10:52 鸭子船长 阅读(423) 评论(0) 推荐(0) 编辑
摘要:转自:http://www.cnblogs.com/steven_oyj/archive/2010/05/22/1741374.html一、基本概念 动态规划过程是:每次决策依赖于当前状态,又随即引起状态的转移。一个决策序列就是在变化的状态中产生出来的,所以,这种多阶段最优化决策解决问题的过程就称为... 阅读全文
posted @ 2015-07-27 17:00 鸭子船长 阅读(189) 评论(0) 推荐(0) 编辑
摘要:转自http://blog.csdn.net/tqtuuuu/article/details/6652144构造函数 对于C++的构造函数,暂且将其分为以下几类:1. 默认构造函数2. 隐士转换构造函数3. 拷贝构造函数4. 其它构造函数 1. 默认构造函数表示没有任何参数的构造函数,当自定义任何... 阅读全文
posted @ 2015-07-27 10:41 鸭子船长 阅读(336) 评论(0) 推荐(0) 编辑
摘要:一 PerformanceCounter 基本介绍1 简单介绍表示 Windows NT 性能计数器组件命名空间:System.Diagnostics程序集:System(在 system.dll 中)2 构造函数(只介绍本文要用到的)PerformanceCounter (String, Stri... 阅读全文
posted @ 2015-07-27 10:28 鸭子船长 阅读(6057) 评论(0) 推荐(1) 编辑
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
posted @ 2015-07-24 16:39 鸭子船长 阅读(160) 评论(0) 推荐(0) 编辑
摘要:转自http://www.cppblog.com/wanghaiguang/archive/2012/06/05/177627.htmlSTL Set介绍集合(Set)是一种包含已排序对象的关联容器。多元集合(MultiSets)和集合(Sets)相像,只不过支持重复对象,其用法与set基本相同。S... 阅读全文
posted @ 2015-07-23 15:20 鸭子船长 阅读(297) 评论(0) 推荐(0) 编辑
摘要:转自http://blog.csdn.net/lskyne/article/details/10418823Lists将元素按顺序储存在链表中. 与 向量(vectors)相比, 它允许快速的插入和删除,但是随机访问却比较慢.assign() 给list赋值back() 返回最后一个元素begin(... 阅读全文
posted @ 2015-07-23 15:12 鸭子船长 阅读(4277) 评论(0) 推荐(0) 编辑
摘要:转自http://www.cnblogs.com/marchtea/archive/2012/02/27/2370068.html总所周知,c++的stl中提出了iterator的概念,这是C所没有的.在一般的使用中,iterator的行为很像c内建的指针.而在java和c#中索性就直接取消了指针,... 阅读全文
posted @ 2015-07-23 14:50 鸭子船长 阅读(555) 评论(0) 推荐(0) 编辑
摘要:C++map的基本操作和使用来源:(http://blog.sina.com.cn/s/blog_61533c9b0100fa7w.html) - C++map的基本操作和使用_Live_新浪博客 Map是c++的一个标准容器,她提供了很好一对一的关系,在一些程序中建立一个map可以起到事半功倍的效... 阅读全文
posted @ 2015-07-23 14:47 鸭子船长 阅读(238) 评论(0) 推荐(0) 编辑
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matr... 阅读全文
posted @ 2015-07-23 12:35 鸭子船长 阅读(146) 评论(0) 推荐(0) 编辑
摘要:Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except... 阅读全文
posted @ 2015-07-23 12:34 鸭子船长 阅读(162) 评论(0) 推荐(0) 编辑
摘要:Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ... 阅读全文
posted @ 2015-07-23 12:33 鸭子船长 阅读(147) 评论(0) 推荐(0) 编辑
摘要:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top()... 阅读全文
posted @ 2015-07-23 12:32 鸭子船长 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or minus... 阅读全文
posted @ 2015-07-23 12:32 鸭子船长 阅读(148) 评论(0) 推荐(0) 编辑
摘要:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired bythis... 阅读全文
posted @ 2015-07-23 12:31 鸭子船长 阅读(205) 评论(0) 推荐(0) 编辑
摘要:Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"]. 1 class ... 阅读全文
posted @ 2015-07-23 12:30 鸭子船长 阅读(156) 评论(0) 推荐(0) 编辑
摘要:Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and empty... 阅读全文
posted @ 2015-07-23 12:30 鸭子船长 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.Hint:H... 阅读全文
posted @ 2015-07-23 12:29 鸭子船长 阅读(197) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota... 阅读全文
posted @ 2015-07-23 12:28 鸭子船长 阅读(207) 评论(0) 推荐(0) 编辑
摘要:Given an integer, write a function to determine if it is a power of two.1 bool isPowerOfTwo(int n) {2 if(n<=0)3 return false;4 if(n&(n-1... 阅读全文
posted @ 2015-07-23 12:27 鸭子船长 阅读(146) 评论(0) 推荐(0) 编辑
摘要:Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6... 阅读全文
posted @ 2015-07-23 12:26 鸭子船长 阅读(155) 评论(0) 推荐(0) 编辑
摘要:Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front o... 阅读全文
posted @ 2015-07-23 12:26 鸭子船长 阅读(148) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space? 1 /** 2 * Definition for singly-li... 阅读全文
posted @ 2015-07-23 12:25 鸭子船长 阅读(229) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ... 阅读全文
posted @ 2015-07-23 12:24 鸭子船长 阅读(174) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ... 阅读全文
posted @ 2015-07-23 12:23 鸭子船长 阅读(209) 评论(0) 推荐(0) 编辑
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is1 -> 2 -> 3 -> ... 阅读全文
posted @ 2015-07-23 12:21 鸭子船长 阅读(129) 评论(0) 推荐(0) 编辑
摘要:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv... 阅读全文
posted @ 2015-07-23 12:20 鸭子船长 阅读(116) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示