- 博客(14)
- 资源 (3)
- 收藏
- 关注
原创 使用Python实现Map Reduce程序
Hadoop 框架是使用Java编写的但是我们仍然需要使用像C++、Python等语言来实现 Hadoop程序。在Hadoop官网https://hadoop.apache.org/docs/r1.0.4/cn/mapred_tutorial.html上有java版本的示例,但是其他语言的没有。前几天我需要用hadoop做一些统计,但是很久没有写过java了,一时半会儿觉得太麻烦。所以决定用pyt
2016-08-18 17:51:13 438
原创 Sqoop导入数据到hdfs
从Postgre导入数据到hdfs需要是用Sqoop。Sqoop是一个开源的工具,能将数据表从关系数据库导入HDFS或Hive上。安装Sqoop配置好环境,执行命令:sqoop import --connect jdbc:postgresql://1.1.1.1:5432/lrs --username user --password psswd --table table_statemen
2016-08-17 22:51:14 2094
原创 Hadoop、HDFS和Map/Reduce
Hadoop是一个开发和运行处理大规模数据的软件平台,是Appach的一个用java语言实现开源软件框架,实现在大量计算机组成的集群中对海量数据进行分布式计算框架。Hadoop的核心是分布式文件系统HDFS和map reduce模型。HDFSHadoop分布式文件系统(HDFS)被设计成适合运行在通用硬件(commodity hardware)上的分布式文件系统。它和现有的分布式文件系统有
2016-08-17 22:33:45 1542
原创 Merge Intervals解题报告
题目描述Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]解题思路这道题其实就是区间合并的问题,其实思路很简单,首先把数组中的interval按照i
2016-08-17 19:06:34 315
原创 Longest Common Prefix解题报告
题目描述Write a function to find the longest common prefix string amongst an array of strings.解题思路因为题目要求的是求所有字符串的最长匹配前缀,那么把每一个字符串都来比较,然后从已经比较得到的前缀中截取就可以了。但是这样比较的话就有n(n-1)次,但是要求每个字符串都有的前缀,其实只需要将数组中
2016-08-17 18:52:33 199
原创 String to Integer (atoi)解题报告
感觉string的题目在leetcde中都比较靠前,是不是因为是最早出的,所以题目的表述都有一些简略,很多时候看不懂题orz。题目描述Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, pl
2016-08-17 18:13:13 1106
原创 Search in Rotated Sorted Array解题报告
题目描述Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur
2016-08-17 18:04:56 233
原创 Copy List with Random Pointer解题报告
题目描述A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.解题思路这个题有两种解题思路,一种是hashmap的形式,在复制节点的时候, 对队列中的原有节点和复制之后的节点进
2016-08-17 17:42:44 253
原创 Merge k Sorted Lists解题报告
题目描述Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.代码/** * Definition for singly-linked list. * struct ListNode { * int val; * Li
2016-08-17 17:25:56 190
原创 Convert Sorted List to Binary Search Tree解题报告
题目描述Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解题思路这道题有一道非常类似的题:Convert Sorted Array to Binary Search Tree,这道题的意思是将排序数组变成二叉搜索树
2016-08-17 17:06:44 209
原创 Reverse Linked List II结题报告
题目描述Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.解题思路这是翻转链表的升级版。翻转链表https:
2016-08-17 16:18:31 156
原创 Partition 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 eac
2016-08-17 13:12:33 258
原创 xAPI发送数据-Python版本
Python版本的xAPI库比java版本要好上手一点。首先在这个网站https://github.com/RusticiSoftware/TinCanPython下载官方的库,我们发送数据所需要的库函数在tincan这个包里。所以我们要写python数据发送的demo只需要复制tincan包到我们的工程文件中就可以,或者设置tincan包的位置。python版本的代码如下:#enco
2016-08-17 10:59:09 1654 2
原创 xAPI发送数据Demo-Java版本
xAPIxAPI又名为Experience API,是一种描述学习内容和学习行为的软件数据标准,通过xAPI不同的学习行为存储系统之间可以进行相互通讯。LRS (Learning Record Store)又称为学习行为数据存储系统,LRS通过其他社交网站如微博、微课平台、社区论坛等收集用户的学习行为,并按照xAPI的数据格式要求进行存储。下面是一段示例xAPI的代码:{"id":
2016-08-17 10:49:57 3530 3
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人