Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, 20,000 element(s) must be compared.
Answer:
Code is given below and output is attached as an image.
Explanation:
#include <iostream>
#include <fstream>
using namespace std;
bool isPalindrome(int n)
{
// Find reverse of n
int rev = 0;
for (int i = n; i > 0; i /= 10)
rev = rev * 10 + i % 10;
// If n and rev are same,then n is a palindrome
return (n == rev);
}
int main()
{
int min = 1; // Lower Bound
int max = 200; // Upper Bound
ofstream myfile;
myfile.open("palindrome.txt");
for (int i = min + 1; i < max; i++)
if (isPalindrome(i))
myfile << i << endl;
myfile.close();
return 0;
}
3D printing helps to reduce the time it takes for a manufacturer to create the product. This lets manufacturers invest their time to make flawless products because the production cycle time is reduced.
Answer:
See explaination
Explanation:
Keep two iterators, i (for nuts array) and j (for bolts array).
while(i < n and j < n) {
if nuts[i] == bolts[j] {
We have a case where sizes match, output/return
}
else if nuts[i] < bolts[j] {
this means that size of nut is smaller than that of bolt and we should go to the next bigger nut, i.e., i+=1
}
else {
this means that size of bolt is smaller than that of nut and we should go to the next bigger bolt, i.e., j+=1
}
}
Since we go to each index in both the array only once, the algorithm take O(n) time.
Answer: True
Explanation:
Yes, the given statement is true that the due to the very low feasibility the IT (Information technology) department are not aware of the hidden backlog that basically contain projects.
The feasibility is the main factor in the IT department as it helps to study whole objective of the project and then also uncover all the strength and weakness of the project so that we can easily go through the details to make the project more efficient and reliable.