当前位置:网站首页>汇编实现冒泡排序
汇编实现冒泡排序
2022-07-30 10:37:00 【华为云】
一、题目
汇编程序实现冒泡排序
二、要求
片内RAM30H开始的32个单元中分布着随机的有符号8位二进制数,按从小到大的顺序进行排序,排序后的数据仍然保存到30H开始的32个单元中(低地址存放小数据)
三、过程及结果记录
1. 在程序存储器中构建一个TABLE,该表格具有32个随机产生的8位二进制数,如:TABLE :DB 1,3,9,2,17,4,11,6
DB 5,20,100,64,21,14,79,35
DB 92,7,91,23,65,16,13,18
DB 18,73,65,101,27,19,62,69
2. 利用查表指令“MOVC A,@A+DPTR”分别将表格中的数字读取到30H~4FH单元中。
3. 使用“冒泡排序法”将它们排序即可。“冒泡排序法”的基本原理是:
遍历所有32个数据找出其中最大者,并记下最大数据所在存储位置,然后将这个最大数据放置在最后一个单元,同时,将最后一个单元原来的数据保存到这个最大值原来所处的位置,完成第一轮排序。
4. 遍历除了最后一个单元以外的前面31个单元的数据并找出其中最大者,并记下其所在位置。遍历完这一遍后将找到的最大数据保存在倒数第二个单元,并将倒数第二个单元原来的数据保存在刚刚找到的那个最大值原来所在的位置处,完成第二轮排序。依次类推,用同样的方法把所有的数据排好序即可。每一轮将会把当前还未排序的最大的数冒出,因此一共需要冒泡31轮。
冒泡排序的实验结果如下:
图1:排序结果
实验整体思路如下:
图2:实验思路
四、实验源程序
边栏推荐
- kubernetes的一些命令
- 【梦想起航】
- 真正懂经营管理的CIO具备哪些特质
- [100 Solidity Skills] 1. Contract reentrancy attack
- mysql分页查询倒序_【Mysql笔记】MySQL实现分页查询[通俗易懂]
- 【 HMS core 】 【 Analytics Kit] [FAQ] how to solve the payment amount in huawei pay analysis shows zero problem?
- 死锁的理解
- 2022全球数字经济大会人工智能专场:AI安全受高度关注
- Beyond Stream Processing !第四届实时计算 Flink 挑战赛启动,49 万奖金等你来拿!
- 还在用Swagger?我推荐这款零代码侵入的接口管理神器
猜你喜欢

Is it too late to apply for PMP now to take the September exam?Share agile full-true mock questions

The configuration process and related syntax of writing markdown format notes in vscode

Security Thought Project Summary

第3章 信息收集

MFCC转音频,效果不要太逗>V<!
![idea2021+Activiti [the most complete note one (basic use)]](/img/60/55cccf257523bed2c8829361cea97c.png)
idea2021+Activiti [the most complete note one (basic use)]

Re16: Read the paper ILDC for CJPE: Indian Legal Documents Corpus for Court Judgment Prediction and Explanation

【HMS core】【FAQ】HMS Toolkit Typical Questions Collection 1

log4js入门

阿里云OSS对象存储
随机推荐
优酷VIP会员周卡只需7.5元,看《沉香如屑》用优酷视频
MySQL | Subqueries
spark udf accepts and handles null values.
PyQt5 - draw sine curve with pixels
By building a sequence table - teach you to calculate time complexity and space complexity (including recursion)
SST-Calib: A lidar-visual extrinsic parameter calibration method combining semantics and VO for spatiotemporal synchronization calibration (ITSC 2022)
ODrive应用 #4 配置参数&指令「建议收藏」
数据库事务,JDBC操作和数据类型
【AGC】增长服务2-应用内消息示例
Flink_CDC construction and simple use
(***Key points***) Flink common memory problems and tuning guide (1)
MFCC to audio, the effect should not be too funny >V
Security Thought Project Summary
Beyond Stream Processing !第四届实时计算 Flink 挑战赛启动,49 万奖金等你来拿!
Drag and drop events, dataTransfer, getBoundingClientRect
360闷声干大事获赞无数,数字安全如何保障?还得看企业安全云
Security tip: FreeType in Qt
360 released a future-oriented EDR to protect the security of government and enterprise user terminals in an all-round way
Linux内核设计与实现(十)| 页高速缓存和页回写
【HMS core】【FAQ】HMS Toolkit Typical Questions Collection 1

