@Override
	public void delete(Key key)
	{
		if (isEmpty())
			return;

		int i = rank(key);
		if (i < N && key.compareTo(keys[i]) == 0)
		{
			for (int j = i; j < N - 1; j++)
			{
				keys[j] = keys[j + 1];
				vals[j] = vals[j + 1];
			}

			N--;
			keys[N] = null; // free memory
			keys[N] = null; // free memory

			// resize if 1/4 full
			if (N == keys.length / 4)
				resize(keys.length / 4);
		}
	}