Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

can someone please help me solve these problems to prepare me for the quiz , tha

ID: 3551405 • Letter: C

Question

can someone please help me solve these problems to prepare me for the quiz , thank you so much !!!

Figure 6 Implement a function that searches for a given value in a vector of integers. If the value is found, the function returns the index of the value in the vector; otherwise it returns -1. Do not assume the values are in order; do not use binary search. For example, for v = (-2, 4. 18. 6. -1) and k=1. the function returns -1, and for k = 4 it returns 1. A declaration of the function is shown in Figure 6. Figure 7 Implement a function that uses binary search to search for a given value in a vector of integers whose elements are in strictly increasing order. If the value is found, the function returns the index of the value in the vector; otherwise, it returns -1. You can assume that the values passed into the function are in strictly increasing order. For example, for v = (-2. 4, 5, 6. 8) and k=1. the function returns -1, and for k = 4 it returns 1. A declaration of the function is shown in Figure 7. Figure 8 Write a function named flatten that takes a 2-dimensional array of integers with 1 rows and 2 columns and returns a vector that contains all of the arrays elements. Copy the values a row at a time. In other words, first copy row into the vector, then row 1, then row 2. and so on. The declaration of flatten is given in Figure 8. Figure 9 Implement a function called findMax that determines the maximum value in a 2-dimensional array. A declaration of the function is shown in Figure 9. The variables ROWS and COLS are constants defined elsewhere in the program; you dont need to define them, just use them.

Explanation / Answer



 9) vector<int> flatten (int a[][]) 
  { vector<int> v=new vector(); 
  for(i=0;i,100;i++) 
  for(j=0;j<100;j++) 
  { v.insert(a[i][j]); 
  } 
  return v; 
  } 
 10) int findmax(double a[][])
 { int max=long_MIN; 
  for(i=0;i,100;i++) 
  for(j=0;j<100;j++) 
  { if(max<a[i][j] 
  { 
  max=a[i][j]
}
  } 
 return max; 
 }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote