/*! * \param i The index of the symbol. * \param c Reference that will contain the symbol at position i after the execution of the method. * \return The number of occurrences of symbol wt[i] in the prefix [0..i-1] * \par Time complexity * \f$ \Order{H_0} \f$ */ size_type inverse_select(size_type i, value_type& c)const { assert(i < size()); if (i == 0) { c = m_wt[0]; return 0; } size_type wt_ex_pos = m_bl_rank(i+1); size_type c_runs = m_wt.inverse_select(wt_ex_pos-1, c)+1; if (c_runs == 0) return 0; if (m_wt[wt_ex_pos-1] == c) { size_type c_run_begin = m_bl_select(wt_ex_pos); return m_bf_select(m_C_bf_rank[c] + c_runs) - m_C[c] + i - c_run_begin; } else { return m_bf_select(m_C_bf_rank[c] + c_runs + 1) - m_C[c]; } }