title: Analysis Of Algorithms Set 2 Asymptotic Analysis
signature: analysis_of_algorithms_set_2_asymptotic_analysis <- function(arr, n, x) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, x, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n, x), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(4L, 5L, 5L, 11L, 13L, 14L, 15L, 19L, 22L, 22L, 23L, 26L, 29L, 29L, 36L, 44L, 48L, 49L, 65L, 65L, 67L, 68L, 70L, 76L, 79L, 79L, 81L, 85L, 88L, 91L, 91L, 92L, 92L, 97L), 17L, 5L, 
          1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-24L, -78L, -32L, -48L, 0L, 4L, -42L), 4L, 0L, 
          -1L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L), 6L, 0L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(38L, 14L, 75L, 16L, 91L, 11L, 98L, 43L, 67L, 9L, 21L, 10L, 82L, 72L, 32L, 81L, 48L, 60L, 2L, 91L, 10L, 90L, 12L, 83L), 17L, 75L, 
          2L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-92L, -92L, -82L, -80L, -76L, -66L, -64L, -64L, -56L, -48L, -38L, -38L, -34L, -32L, -32L, -10L, -8L, -6L, -2L, 0L, 8L, 10L, 18L, 20L, 22L, 22L, 30L, 34L, 38L, 38L, 38L, 44L, 50L, 52L, 56L, 64L, 64L, 66L, 70L, 76L, 88L), 25L, 25L, 
          -1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L), 11L, -1L, 
          -1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(1L, 4L, 4L, 4L, 4L, 8L, 12L, 13L, 14L, 14L, 22L, 25L, 25L, 27L, 29L, 33L, 36L, 38L, 40L, 40L, 40L, 41L, 47L, 47L, 47L, 48L, 48L, 50L, 51L, 52L, 52L, 52L, 55L, 56L, 59L, 59L, 62L, 64L, 66L, 77L, 82L, 84L, 90L, 91L, 91L, 93L), 38L, 4L, 
          1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-90L, -60L, -58L, -72L, 92L, 54L, -32L, -70L, -94L, 18L, 64L, -90L, -90L, -56L, 82L, -14L, -74L, -96L, -90L, -8L, -48L, 76L, -28L, 10L, -52L, -8L, -46L, -32L, 82L, 46L, 58L, 92L, 4L, 48L, -96L, -66L, 60L, 60L, 62L, -68L), 22L, 22L, 
          -1L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L), 8L, 8L, 
          -1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(42L, 17L, 77L, 96L, 72L, 36L, 74L, 97L, 7L, 94L, 80L, 7L, 27L, 58L, 49L, 81L, 51L, 9L), 16L, 11L, 
          -1L
      )))
  
  }
  
  main()
source_py: def analysis_of_algorithms_set_2_asymptotic_analysis(arr, n, x):
      i = 0
      for i in range(i, n):
          if (arr[i] == x):
              return i
      return (- 1)
source_cpp: int analysis_of_algorithms_set_2_asymptotic_analysis(vector<int> arr, int n, int x) {
    int i;
    for ( i = 0;
    i < n;
    i ++ ) {
      if ( arr [ i ] == x ) return i;
    }
    return - 1;
  }