数据结构和算法
hjhjavac
这个作者很懒,什么都没留下…
展开
-
Erlang的算法-(二)合并排序/归并排序
可从这里了解合并排序/归并排序的思想 http://blog.csdn.net/touch_2011/article/details/6785881 http://blog.csdn.net/feixiaoxing/article/details/6846008直接上Erlang的代码%% ------------- %% 合并排序/归并排序 %% --------------module(me原创 2015-06-10 00:29:05 · 1299 阅读 · 0 评论 -
Erlang的算法-(三)堆快排
Erlang的堆排序至于堆排内容和原理可以看一下博客 http://blog.csdn.net/feixiaoxing/article/details/6846664 http://www.cnblogs.com/dolphin0520/archive/2011/10/06/2199741.html-module(heap_sort). -compile(export_all).%% 堆调整 h原创 2015-06-11 00:25:03 · 916 阅读 · 0 评论 -
【Leetcode算法】-Add Digits
题目: Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has原创 2015-10-02 01:02:11 · 671 阅读 · 0 评论 -
【Leetcode算法】- Move Zeroes
Move ZeroesGiven an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling原创 2015-10-02 01:17:01 · 512 阅读 · 1 评论 -
【Leetcode算法】- Rotate Array
题目: Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note: Try to come up as many solutions as you can,原创 2015-10-05 21:47:35 · 386 阅读 · 0 评论 -
【Leetcode算法】- Add Binary
题目: Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.链接: https://leetcode.com/problems/add-binary/#include <iostream> #include <string> u原创 2015-10-05 19:27:45 · 330 阅读 · 0 评论 -
Erlang的算法-(一)递归快速排序和MapReduce分布式的快排
Erlang的作者Joe Armstrong发表了一段代码来表示MapReduce版本的Erlang标准lists:map/2方法 Map阶段:在这个阶段,通过Map过程,将原始数据列表,处理成中间数据,用于Reduce过程的处理 Reduce阶段:将Map阶段产生的中间数据综合归纳成输出结果先看看下面这段代码,实现了lists:map/2的分布式计算-module(pmap). -export原创 2015-06-09 23:59:17 · 2568 阅读 · 0 评论