知识点总结2 External Sorting, Bucket Sorting, and Radix Sorting

External Sorting

Usage: Sort huge data with limited memory space.

Main idea: Divide (in order to fit in the main memory), thenmerge together.

One example from Wikipedia:

Sort 900 MB data with 100 MB RAM

1. Read 100 MB data in main memory and sort it by any sortalgorithm, like Quicksort.

2. Write the sorted 100 MB data back to the main memory.

3. Repeat step 1 and step 2 until 900 MB all being dividedinto 9 different chunks in the disk.

4. Read the first 10 MB data of every sorted 100 MB chunksinto main memory. 10 MB = (100 MB / (9 chunks + 1). We have 90 MB input dataspace, and let 10 MB to be an output buffer. Use a 9-way merge to put sortedresult into the 10 MB output buffer space. Whenever the 10 MB output bufferspace is filled, we append this already sorted 10 MB data into final outputfile, and clear this 10 MB output buffer memory. Whenever the 10 MB input datais used up, we grab next (sorted) 10 MB data from the same 100 MB chunks.

Key: minimize reading and writing operations to the disk, sowe only use one merge process in the above example.

Example needs multiple merge processes:

When we have 50 GB data with only 100 MB RAM, if we only useone merge process, 500 separate chunks are needed, which means (100 MB / (500chunks + 1)) = 0.2 MB = 200 KB data. We can only retrieve around 200 KB datafrom each chunk at a time.

So we add another layer of merge:

1. Merge 25 chunks at a time, which results in 20 largerchunks.

2. Merge 20 chunks.

 

Bucket Sorting

If each value has a bucket, then it is Counting Sort.

If every time two buckets are provided, then it is QuickSort.

 

Radix Sorting

MSD (lexicographic) and LSD

O(kn), where n is number of items, which all contains lessthan or equal to k digits.

 

Overloading(different parameters, return types are same; compile time event)

Overriding(re-write inherited methods with same method signatures, including methodnames, parameters, and return types; run time event)

 

JavaScript Closure

http://stackoverflow.com/questions/111102/how-do-javascript-closures-work

 

A* Search Algorithm

 

Reference Counting

 

Design Pattern

Singleton

http://blog.csdn.net/yeyinfei321/article/details/12968879

Factory

Abstract Factory:

AbstractFactory, ConcreteFactoryA, ConcreteFactoryB, AbstractProductA, ConcreteProductA1, ConcreteProductA2, AbstractProductB, ConcreteProductB1, ConcreteProductB2

Simple Factory :

Creator, Product, ConcreteProduct

Factory Method:

AbstractCreator, ConcreteCreator, AbstractProduct, ConcreteProduct


Difference between Abstract Factory and Factory Method:

http://stackoverflow.com/questions/5739611/differences-between-abstract-factory-pattern-and-factory-method


Reference Counting

Often used in Garbage Collection

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值