I have to estimate time complexity of Solve():
// Those methods and list<Element> Elements belongs to Solver class void Solver::Solve() { while(List is not empty) Recursive(); } void Solver::Recursive(some parameters) { Element WhatCanISolve = WhatCanISolve(some parameters); //O(n) in List size. When called directly from Solve() - will always return valid element. When called by recursion - it may or may not return element if(WhatCanISolve == null) return; //We reduce GLOBAL problem size by one. List.remove(Element); //This is list, and Element is pointed by iterator, so O(1) //Some simple O(1) operations //Now we call recursive function twice. Recursive(some other parameters 1); Recursive(some other parameters 2); } //This function performs search with given parameters Element Solver::WhatCanISolve(some parameters) { //Iterates through whole List, so O(n) in List size //Returns first element matching parameters //Returns single Element or null } My first thought was that it should be somwhere around O(n^2).
Then I thought of
T(n) = n + 2T(n-1) which (according to wolframalpha) expands to:
O(2^n) However i think that the second idea is false, since n is reduced between recursive calls.
I also did some benchmarking with large sets. Here are the results:
N t(N) in ms 10000 480 20000 1884 30000 4500 40000 8870 50000 15000 60000 27000 70000 44000 80000 81285 90000 128000 100000 204380 150000 754390 
WhatCanISolveworks. I.e. when can it return null (w.r.t. list size).