引用本文: |
-
徐金建,汤彬.免用第三变量的两变量值交换[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. [点击复制]
|
|
摘要: |
针对采用第三变量两变量值的交换占用多余内存的不足,提出算术运算法、布尔型变量的交换法、异或运算法和异或运算取反法等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 |