Untitled
unknown
c_cpp
a year ago
1.2 kB
3
Indexable
template <typename T> std::string cyclic_double_queue<T>::print_status() const { //TODO: Remove following line and add your implementation here. std::string result; if(m_size == 0){ for(size_t i = 0; i<m_capacity; ++i){ result += "[-]"; } } else { for (size_t i = 0; i < m_capacity; ++i) { // 2 // if ( i < m_backIndex && m_backIndex < m_frontIndex) { // // queue is B - F // result += "[+]"; // } // else if (i >= m_frontIndex && i < m_backIndex && m_backIndex < m_capacity) { // // queue is F - B // result += "[+]"; // } // else { // result += "[-]"; // } if(i < m_backIndex && i < m_frontIndex){ result += "[+]"; } else if(i < m_frontIndex){ result += "[-]"; } else{ result += "[+]"; } } } return result; }
Editor is loading...
Leave a Comment