C
C
ccc352015-09-24 20:04:08
Algorithms
ccc35, 2015-09-24 20:04:08

Estimate the complexity of inserting strings into the DMU of a list?

There is a doubly linked list with dynamic arrays of pointers to strings. When a file is loaded, the lines are distributed in an orderly manner into nodes. Each next node is 2 times larger than the previous one. The size of the first node is 10 lines. When simultaneously loading a file from 1 to 1000 times, 175 lines long and 11kb in weight, the growth order of the function is y=7725x^2.001. Question. Is this normal and is it possible to achieve an order of growth of a function less than a quadratic one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Schullz, 2015-09-25
@ccc35

You need to put the lines in a self-balancing tree (AVL, red-black, etc.). In C++, it is implemented in set and muliset STL containers. The complexity of adding will be - logarithm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question