dynamic sorted jagged array data structure in C++ programming language