summerhumphries3
28.10.2020 •
Computers and Technology
3.) The function remove of the class arrayListType removes only the first occurrence of an element. Add the function removeAll as an abstract function to the class arrayListType, which would remove all occurrences of a given element. Also, write the definition of the function removeAll in the class unorderedArrayListType and write a program to test this function.
Solved
Show answers
More tips
- S Science and Technology How to Restore the Diamond Shine to Your Tarnished Silverware...
- C Computers and Internet Boost your processor performance with these easy tips...
- L Leisure and Entertainment When will Maslenitsa start?...
- F Food and Cooking Discovering the Mysterious Fruit of Feijoa...
- B Business and Finance How to Open an Online Store? A Detailed Guide for Beginners...
- W Work and Career How to Write a Resume That Catches the Employer s Attention?...
- C Computers and Internet Е-head: How it Simplifies Life for Users?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
Answers on questions: Computers and Technology
- M Mathematics Please help me with this geometry question...
- M Mathematics (model #1) 1 cm=6.25 feet (model #2) 1 cm=1.25 feetabove are two different models of the same rectangular patio. if the area of the model on the left is 4 sq cm, what...
- H History Which of the following was NOT an improvement created by King Solomon? He kept the peace with other peoples. The Israelites began to grow rich He conquered the surrounding...
- S Social Studies What are the provisions in a secular Constitution?...
- B Biology Which ocean basin is located on was entirely in the southern hemisphere a. pacific ocean b. indian ocean c. atlantic ocean d. article ocean...
Ответ:
#include <stdio.h>
#include <time.h>
int main()
{
clock_t start, end;
double cpu_time_used;
//starting the cpu clock.
start = clock();
for(int i=0; i<10000; i++){
my_func_with_only_subscript();
}
// closing the cpu clock.
end = clock();
// calculating time elapsed in secs.
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
printf("Time taken with subscript references::%f\n",cpu_time_used);
// starting the cpu clock
start = clock();
for(int i=0; i<10000; i++){
my_func_with_pointers();
}
// closing the cpu clock.
end = clock();
// calculating the time elapsed in array reference through pointers.
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
printf("Time taken with pointers::%f\n",cpu_time_used);
return 0;
}
// function to reference the 2D array through subscripts.
void my_func_with_only_subscript()
{ //assuming that the usage of
int arr[15][5] = {0}; //square matrice is not mandatory
for(int j=0; j<5 ; j++){
for(int i=0; i<15; i++){
arr[i][j]; //no operation is done, only accessing the element
}
}
return;
}
// function to reference the 2D array through pointers.
void my_func_with_pointers()
{ //assuming that the usage of
int arr[15][5] = {0}; //square matrice is not mandatory
for(int j=0; j<5 ; j++){
for(int i=0; i<15; i++){
*(*(arr+i)+j); //no operation is done, only accessing the element
}
}
return;
}
/******************************************************************************************************************************/
OUTPUT
[Attached in the attachments]