由买买提看人间百态

topics

全部话题 - 话题: insertint
(共0页)
v***o
发帖数: 287
1
来自主题: JobHunting版 - 一个算法题目
public static void compressString(char[] input)
{
if (input == null)
return;
int previous = 0, current = 0, count = 0;

while (current < input.length)
{
if (input[current]!= input[previous])
{
insertInt(input, previous +1, Integer.toString(count));
input[previous + Integer.toString(count).length + 1] = input[
current];
previous = current;
current ++;
count = 0;
}
else
{ current... 阅读全帖
a*****a
发帖数: 1429
2
来自主题: Java版 - 这两个程序哪个更快?

twice. insertint and converting.
Read StringBuffer's source first:-). Insert uses arraycopy
too.
(共0页)