c++ - Derive the execution time growth rate (BigO) of the following code -
Performance time increment rate What is the big o of this code?
zero doDiff (int set a [], int set [], int size a, int size b) {cut int MAX = 10; // validate setA and setB if ((size A == 0) & amp; (sizeB == 0) cout & lt; & Lt; "Both sets are empty" & lt; & Lt; Endl; And cout & lt; & Lt; "Symmetrical difference: {"; For (int i = 0; i gt; size -) if (set [size -1] == n set) is true; return false; } When I calculate the big o of this code, I end up with O (N * N * N) || O (n ^ 3) I'm not sure what the exact execution time increment rate for this code is, please help me. Thanks in advance
This seems unfair To fill an answer with, but like the homework, when it sounds, I think that they are a better way of goal (which is for you to understand how it works):
- What is the "big-o" code of
member ? This is important, because doDiff is very dependent on it. - How often doDiff call
member ? Li> - If each call takes the same time in
member , then member is o (x), and doDiff call Member Wi Bar, What is "big-o" of doDiff ?
Comments
Post a Comment