自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(59)
  • 收藏
  • 关注

原创 spark源码分析:spark运行总流程

整体流程图:1、Driver程序的代码运行到action操作,触发了SparkContext的runJob方法。2、SparkContext调用DAGScheduler的runJob函数。3、DAGScheduler把Job划分stage,然后把stage转化为相应的Tasks,把Tasks交给TaskScheduler。4、通过TaskScheduler把Ta

2016-12-08 22:44:03 398

原创 spark运行模式

Spark的运行模式多种多样,灵活多变,部署在单机上时,既可以用本地模式运行,也可以用伪分布式模式运行;而当以分布式集群的方式部署时,底层的资源调度既可以依赖于外部的资源调度框架,也可以使用Spark内建的Standalone模式。对于外部资源调度框架的支持,目前主要包括Mesos模式和Hadoop YARN模式。接下来,将对分布式集群部署的模式进行讲解。Standalone模式Sta

2016-12-08 22:24:21 468

原创 Spark总体架构

Spark的架构图如下图所示:从上面的架构图中,我们可以看出,整个架构可以分为一下几部分:Client:用户提交作业的客户端Driver:运行application的main函数,创建sparkcontext初始化运行环境, 在Spark中由SparkContext负责和ClusterManager通信,进行资源的申请、任务的分配和监控等;当Executor部分运行完毕后,

2016-12-08 22:14:08 351

原创 215. Kth Largest Element in an Array(heap)

题目:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, r

2016-09-24 21:10:58 267

原创 207. Course Schedule(gragh)

题目:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expr

2016-09-23 23:40:10 224

原创 71. Simplify Path(stack)

题目:Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"简化路径,规则:..返回一级目录.无效运用stack记录路径public clas

2016-09-23 22:06:07 152

原创 23. Merge k Sorted Lists(heap)

题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并k个有序链表创建一个大小为K的堆,每次取出对顶元素,然后添加堆顶元素在原链表的下一个元素。最后取出的元素形成的链表就是有序链表 public Lis

2016-09-23 18:16:38 216

原创 212. Word Search II(Trie)

题目:Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are

2016-09-23 17:04:21 227

原创 208. Implement Trie (Prefix Tree)(Trie)

题目:Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.实现字典树,用hashmap来存储,key为当前字符,value为子树class Tr

2016-09-23 15:38:06 162

原创 87. Scramble String(dfs+剪枝)

题目:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great /

2016-09-21 12:03:42 156

原创 97. Interleaving String(dp)

题目:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbba

2016-09-21 09:51:05 168

原创 123. Best Time to Buy and Sell Stock III(dp)

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:

2016-09-20 17:22:56 135

原创 122. Best Time to Buy and Sell Stock II(贪心)

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i

2016-09-20 16:55:28 173

原创 121. Best Time to Buy and Sell Stock(贪心)

题目:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th

2016-09-20 16:48:10 177

原创 85. Maximal Rectangle(dp)

题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1

2016-09-20 16:35:58 236

原创 84. Largest Rectangle in Histogram(dp)

题目:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram wher

2016-09-19 20:15:06 238

原创 79. Word Search

题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or v

2016-09-19 17:34:08 125

原创 37. Sudoku Solver(dfs)

题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()",

2016-09-19 16:56:29 188

原创 22. Generate Parentheses(dfs)

题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()",

2016-09-19 15:40:43 138

原创 40. Combination Sum II

题目:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in th

2016-09-10 16:57:49 112

原创 39. Combination Sum

题目:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlim

2016-09-10 16:34:39 149

原创 93. Restore IP Addresses(dfs+剪枝)

题目:Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]

2016-09-09 20:13:15 198

原创 28. Implement strStr()(String字符串匹配)

题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribe to see which companies asked this question

2016-08-25 23:12:19 245

原创 86. Partition List(list)

题目:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in

2016-08-24 21:33:02 235

原创 52. N-Queens II(dfs)

题目:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Subscribe to see which companies asked this question

2016-08-24 21:06:46 175

原创 51. N-Queens(dfs)

题目:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens

2016-08-24 19:00:24 138

原创 53. Maximum Subarray(dp)

题目: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,-5,4],the contiguous subarray [4,-

2016-08-24 11:37:27 120

原创 45. Jump Game II(贪心)

题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Yo

2016-08-23 16:56:33 170

原创 55. Jump Game(贪心)

题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.De

2016-08-23 15:22:06 184

原创 69. Sqrt(x)(分治)

题目:Implement int sqrt(int x).Compute and return the square root of x.求平方根,用二分法,时间复杂度为O(lgN)代码:public class Solution { public int mySqrt(int x) { if(x<2)return x; in

2016-08-23 15:05:41 227

原创 50. Pow(x, n)(分治)

题目:Implement pow(x, n).Subscribe to see which companies asked this question分治法代码:public class Solution { public double myPow(double x, int n) { if(n<0){ return 1.0/power

2016-08-23 01:11:43 406

原创 126. Word Ladder II(bfs+dfs)

题目:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord toendWord, such that:Only one letter can be changed at a

2016-08-23 00:39:39 442

原创 127. Word Ladder(BFS)

题目:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence frombeginWord to endWord, such that:Only one letter can be chang

2016-08-22 15:59:59 198

原创 120. Triangle(dp)

题目:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3

2016-08-22 00:05:12 143

原创 130. Surrounded Regions(BFS)

题目:Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For exa

2016-08-21 23:22:46 161

原创 133. Clone Graph

题目:OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each node, and , as a separator for node label and each neighbor of the node.As an exa

2016-08-21 17:26:59 90

原创 63 Unique Paths II (dp)

题目:Follow up for ”Unique Paths”:Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the g

2016-08-21 00:32:46 118

原创 62. Unique Paths(dp+深搜)

题目:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to r

2016-08-19 18:08:50 168

原创 140. Word Break II(dp)

题目:Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, giv

2016-08-19 16:45:46 214

原创 139. Word Break(dp)

题目:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict

2016-08-18 23:27:26 222

空空如也

空空如也

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

TA关注的人

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