网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

PostgreSQL中REPLACEMENTSELECTIONSORT使用与哪种情况

本篇内容主要讲解“PostgreSQL中REPLACEMENT SELECTION SORT使用与哪种情况”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“PostgreSQL中REPLACEMENT SELECTION SORT使用与哪种情况”吧!

创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都做网站、成都网站建设、襄汾网络推广、重庆小程序开发公司、襄汾网络营销、襄汾企业策划、襄汾品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供襄汾建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com

REPLACEMENT SELECTION SORT,适用于内存较小的情况(在高德纳提出该算法的年代,内存比起现在少了N个数量级).
该算法在PG 9.x或以下版本在使用,在高版本已被废弃.其算法实现如下:

Let m be the number of records to be sorted which can be kept in the main memory. Imagine that these memory locations are registers and assume we can mark them as “on” or “off”. Replacement selection can overlap reading, sorting and writing.

Step1: The m registers are filled with records from the input to be sorted.
Step2: All registers are put into the “on” state.
Step3: Select the register which has the smallest of all “on” registers.
Step4: Transfer the contents of the selected register to the output (call it as key Y).
Step5: Replace the contents of the selected register by the next input record.
            If new record key > Y
                        Go to step 3
            If new record key = =Y
                        Go to step 4
            If new record key < Y
                        Go to step 6
Step6: Turn the selected key register  “off”.
            If all registers are now  “off”
                        We have completed a sorted substring(run).
                        We start a new substring group and go to step 2.
            Else
                        Go to step 3

下面是该算法的一个例子:

Example: Suppose number of registers is 3 and input keys are 5, 2, 9, 7, 0, 8, 1, 6, 3, 4 ...
            Registers                               Output
            5 2 9                                       2
            5 7 9                                       5
*0 7 9                                     7
*0 8 9                                     8
*0*1 9                                    9
*0*1*6
0 1 6                                       0
3 1 6                                       1
3 4 6                                       3
- 4 6                                        4
- - 6                                        6
- - -

相关的数据结构:两个数组,一个存储读取的实际数据,一个标记数组;一个外存,用于存储已完成排序的一个run.
如标记数组全为F(非活动状态),则产生一个run,周而复始,直至所有输入被耗尽为止.
通过这个方法,可以生成N个runs(每个run对应的是已完成排序的部分数据).

CS 351 -Data Organization and Management ( Section: 02)
External_sorting
replacement-selection-sort vs selection-sort

到此,相信大家对“PostgreSQL中REPLACEMENT SELECTION SORT使用与哪种情况”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


分享题目:PostgreSQL中REPLACEMENTSELECTIONSORT使用与哪种情况
文章路径:http://bjjierui.cn/article/gpceji.html

其他资讯