Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 531 Bytes

File metadata and controls

26 lines (16 loc) · 531 Bytes
title 算法4 Java解答 1.2.08
date 2019-02-22 07:35:22 +0800
draft false
tags
JAVA
categories
技术
归档

1.2.08

问题:

Suppose that a[] and b[] are each integer arrays consisting of millions of inte- gers. What does the follow code do? Is it reasonably efficient? int[] t = a; a = b; b = t;

Answer. It swaps them. It could hardly be more efficient because it does so by copying references, so that it is not necessary to copy millions of elements.

分析:

参考: