public int insert(char[] word, int I) {
		int child_index, new_index;
		int i, j, k;
		byte cs;
		ST_NODE parent;
		ST_NODE tmp_node = new ST_NODE();

		tmp_node.child = 0;
		tmp_node.CS = 0;
		tmp_node.I = 0;
		tmp_node.K = 0;

		k = 0;
		if(word.length == 0) 
			return -1;

		search(word);
		k += this.search_end;

		if (this.search_end == 0) { 
			parent = this.head.s_node;
		} else { 
			parent = this.nf[this.search_idx[this.search_end - 1]].node;
		}

		while (k < word.length) {
			cs = parent.CS;
			if (cs == 0) { 			// no child
				new_index = alloc(1);
				node_copy(this.nf[new_index].node, tmp_node);
				this.nf[new_index].node.K = word[k];
				
				parent.CS = 1;
				parent.child = new_index;
				this.search_idx[this.search_end] = new_index;
				this.search_word[this.search_end] = word[k];
				this.search_end++;
				k++;
				parent = this.nf[new_index].node;
			} else {
				new_index = alloc(cs + 1);
				child_index = parent.child;
				for (i = 0; i < cs; i++) {
					if (this.nf[child_index + i].node.K < word[k]) {
						ST_NODE node = this.nf[new_index + i].node;
						this.nf[new_index + i].node = this.nf[child_index + i].node;
						this.nf[child_index + i].node = node;
					} else { 
						break;
					}
				}

				node_copy(this.nf[new_index + i].node, tmp_node);
				this.nf[new_index + i].node.K = word[k];

				this.search_idx[this.search_end] = new_index + i;
				this.search_word[this.search_end] = word[k];
				this.search_end++;
				k++;

				for (j = i; j < cs; j++) {
					ST_NODE node = this.nf[new_index + j + 1].node;
					this.nf[new_index + j + 1].node = this.nf[child_index + j].node;
					this.nf[child_index + j].node = node;
				}
					
				parent.child = new_index;
				parent.CS = (byte)(cs + 1);
				free(child_index, cs);

				parent = this.nf[new_index + i].node; 
			}
		}
		
		if(parent.I == 0) {
			parent.I = I;
			return 1;
		} else {
			return 0;
		}
	}