原创 Spark初體驗(1)--SparkPi詳解

先貼出SparkPi的代碼: <pre name="code" class="java">import scala.math.random import org.apache.spark._ /** Computes an appro

原创 初識Hadoop——Hadoop-1.2.1和Hadoop-2.7.1的配置以及常見問題分析

最近在研究Hadoop-1.X的源碼,在安裝Hadoop-1.2.1的時候遇到了很多的問題,待配置好了1.X之後索性也搭建一下2.X的環境吧,結果遇到了更多的麻煩~ 下面就Hadoop學習過程中遇到的問題來與大家分享,同時,也希望技術大牛

原创 LeetCode(1)--Two Sum

題目如下: Given an array of integers, find two numbers such that they add up to a specific target number. The function

原创 LeetCode(3)--Longest Substring Without Repeating Characters

題目如下: Given a string, find the length of the longest substring without repeating characters. For example, the long

原创 LeetCode(5)--Longest Palindromic Substring

題目如下: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S i

原创 LeetCode(6)--ZigZag Conversion

題目如下: The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may wan

原创 排序算法實現以及比較

本文總結了常用的幾種內排序算法的原理、實現以及各個算法性能的比較。雖然網絡上有不少的大神對排序算法進行了比較詳細的介紹,但是,本人一方面是爲了總結一下自己的知識系統,另一方面想以更加通俗易懂的方式讓廣大的初學者對排序算法的思想能

原创 Spark初體驗(2)--WordCount詳解

WordCount代碼如下: import org.apache.spark.{SparkContext, SparkConf} /** * Created by zhangph on 2015/11/25. */ obj

原创 最優決策和最滿意決策問題

蘇格拉底弟子摘麥穗問題        古希臘哲學大師蘇格拉底的三個弟子求教老師:怎樣才能獲得成功?蘇格拉底沒有直接回答,讓他們去麥田,只許往前走,且僅有一次機會,要求是:選摘一個最好最大的麥穗。 第一個弟子沒走幾步就看見一個又大又漂亮的麥

原创 LeetCode(4)--Median of Two Sorted Arrays

題目如下: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted

原创 算法導論-第二章

第二章 算法基礎 第二章 算法基礎 1 插入排序 2 算法分析 3 設計算法 2.1 插入排序 排序問題描述 輸入:n個數的一個序列{a1,a2,..,an} 輸出:輸入序列的一個排列{a1’,a2’,..,

原创 Spark框架

Spark的整體流程爲:Client提交應用,Master找到一個Worker啓動Driver,Driver向Master或者資源管理器申請資源,之後將應用轉化爲RDD Graph,再由DAGScheduler將RDD Graph轉化爲S

原创 LeetCode(125)--Valid Palindrome

題目如下: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases

原创 iPhone5s 換電池、修右上角翹起的悲催過程

下面是電池的參數:     最近發現手機電池續航能力越來越差,並且右上角有點翹屏,所以,準備對手機進行大修,在網上購買了電池和玻璃膠(用來粘屏幕)。在網上看的最好用玻璃膠,然後,我就在網上找玻璃膠,最後,悲催的是哥想買的是小拇指這麼大滴

原创 LeetCode(9)--Palindrome Number

題目如下: Determine whether an integer is a palindrome. Do this without extra space. 解題解題思路: 該問題最大的難道在於無額外的空間,如果沒有此限制