Could you explain to me the input size of the algorithm with these cases? I can't understand the cases with multiple input parameters. Thanks.

algorithm_1( a[1,...,n], b[1,...,n] )
    for i ← 1 to legth[a] step ​1 do
        for j ← 1 to legth[b] step ​1 do
    return 0


algorithm_2( a[1,...,n], b[1,...,n] )
    return 1


algorithm_3( a[1,...,n], n )
    for i ← 0 to n step ​1 do
        sum += a[i]
    return sum


algorithm_4( m, n )
    for i ← 0 to n step ​1 do
        sum += m*2
    return sum
  • $\begingroup$ What did you try? $\endgroup$ – Complexity Mar 27 '18 at 12:35
  • $\begingroup$ You need to add more detail to your question. How $A$ and $B$ are given? $\endgroup$ – Complexity Mar 27 '18 at 12:45
  • 2
    $\begingroup$ Could you be more specific about your problem? The input size is the size of the input. "Size" means size and "input" means input so it's hard to see what you're having difficulty with. $\endgroup$ – David Richerby Mar 27 '18 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.