引用本文
  • 徐金建,汤彬.免用第三变量的两变量值交换[J].广西科学院学报,2004,(2):55-56,63.    [点击复制]
  • Xu Jinjian,Tang Bin.Swap of Two Variables without the Third Variable[J].Journal of Guangxi Academy of Sciences,2004,(2):55-56,63.   [点击复制]
【打印本页】 【在线阅读全文】【下载PDF全文】 查看/发表评论下载PDF阅读器关闭

←前一篇|后一篇→

过刊浏览    高级检索

本文已被:浏览 205次   下载 235 本文二维码信息
码上扫一扫!
免用第三变量的两变量值交换
徐金建, 汤彬
0
(东华理工学院, 江西临川 344000)
摘要:
针对采用第三变量两变量值的交换占用多余内存的不足,提出算术运算法、布尔型变量的交换法、异或运算法和异或运算取反法等4个免用第三个临时变量的两变量值交换方法,并分析这些方法的优缺点
关键词:  变量交换  第三变量  异或运算
DOI:
投稿时间:2003-09-27
基金项目:
Swap of Two Variables without the Third Variable
Xu Jinjian, Tang Bin
(East China Institute of Technology, Linchuan, Jiangxi, 344000, China)
Abstract:
To solve the problem of taking surplus of memory in swapping two variables using the third variable,the methods of arithmetic algorithm,swapping of boolean type variables,XOR and negated XOR are suggested.The advantages and disadvantages of these methods are discussed.
Key words:  swap of variables  the third varcable  XOR

用微信扫一扫

用微信扫一扫