We are left with following problem, upon which TcT provides the
certificate YES(?,O(n^1)).

Strict Trs:
  { f(a, empty()) -> g(a, empty())
  , f(a, cons(x, k)) -> f(cons(x, a), k)
  , g(empty(), d) -> d
  , g(cons(x, k), d) -> g(k, cons(x, d)) }
Obligation:
  runtime complexity
Answer:
  YES(?,O(n^1))

The input is overlay and right-linear. Switching to innermost
rewriting.

We are left with following problem, upon which TcT provides the
certificate YES(?,O(n^1)).

Strict Trs:
  { f(a, empty()) -> g(a, empty())
  , f(a, cons(x, k)) -> f(cons(x, a), k)
  , g(empty(), d) -> d
  , g(cons(x, k), d) -> g(k, cons(x, d)) }
Obligation:
  innermost runtime complexity
Answer:
  YES(?,O(n^1))

The problem is match-bounded by 2. The enriched problem is
compatible with the following automaton.
{ f_0(2, 2) -> 1
, f_0(2, 4) -> 1
, f_0(4, 2) -> 1
, f_0(4, 4) -> 1
, f_1(6, 2) -> 1
, f_1(6, 4) -> 1
, empty_0() -> 2
, empty_0() -> 3
, empty_1() -> 1
, empty_1() -> 5
, g_0(2, 2) -> 3
, g_0(2, 4) -> 3
, g_0(4, 2) -> 3
, g_0(4, 4) -> 3
, g_1(2, 5) -> 1
, g_1(2, 6) -> 3
, g_1(4, 5) -> 1
, g_1(4, 6) -> 3
, g_1(6, 5) -> 1
, g_2(2, 7) -> 1
, g_2(4, 7) -> 1
, g_2(6, 7) -> 1
, cons_0(2, 2) -> 3
, cons_0(2, 2) -> 4
, cons_0(2, 4) -> 3
, cons_0(2, 4) -> 4
, cons_0(4, 2) -> 3
, cons_0(4, 2) -> 4
, cons_0(4, 4) -> 3
, cons_0(4, 4) -> 4
, cons_1(2, 2) -> 3
, cons_1(2, 2) -> 6
, cons_1(2, 4) -> 3
, cons_1(2, 4) -> 6
, cons_1(2, 5) -> 1
, cons_1(2, 5) -> 5
, cons_1(2, 6) -> 3
, cons_1(2, 6) -> 6
, cons_1(2, 7) -> 1
, cons_1(2, 7) -> 5
, cons_1(4, 2) -> 3
, cons_1(4, 2) -> 6
, cons_1(4, 4) -> 3
, cons_1(4, 4) -> 6
, cons_1(4, 5) -> 1
, cons_1(4, 5) -> 5
, cons_1(4, 6) -> 3
, cons_1(4, 6) -> 6
, cons_1(4, 7) -> 1
, cons_1(4, 7) -> 5
, cons_2(2, 5) -> 1
, cons_2(2, 5) -> 7
, cons_2(2, 7) -> 1
, cons_2(2, 7) -> 7
, cons_2(4, 5) -> 1
, cons_2(4, 5) -> 7
, cons_2(4, 7) -> 1
, cons_2(4, 7) -> 7 }

Hurray, we answered YES(?,O(n^1))