Question

Determine the size of an int variable, a double variable, and a pointer on your computer....

Determine the size of an int variable, a double variable, and a pointer on
your computer.
(a) Calculate the break-even point, as a function of n, beyond which the
array-based list is more space efficient than the linked list for lists
whose elements are of type int.
(b) Calculate the break-even point, as a function of n, beyond which the
array-based list is more space efficient than the linked list for lists
whose elements are of type double.

Homework Answers

Answer #1

(a) Consider A to be the size of the array list.

Let P be the size of pointer.

The size of an int element is 4 bytes.

Therefore, the breakeven point as a function of n, beyond which the array-based list is more space efficient than the linked list for lists whose elements are of type int is :

n> (4*D)/(P+4)

(b) Consider A to be the size of the array list.

Let P be the size of pointer.

The size of an int element is 8 bytes.

Therefore, the breakeven point as a function of n, beyond which the array-based list is more space efficient than the linked list for lists whose elements are of type double is :

n> (8*D)/(P+8)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider the following function: double arrayavg(int a[], int n){ int sum=0; for(int i=0; i!=n; ++i){ sum+=a[i];...
Consider the following function: double arrayavg(int a[], int n){ int sum=0; for(int i=0; i!=n; ++i){ sum+=a[i]; } return (double)sum/n; } Rewrite the function to eliminate the array subscripting (a[i]), using pointer arithmatic instead. Write a program that reads a line of input and checks if it is a palindrome (ignoring spaces) Write a program that takes the name of a file as a command line argument, and prints the contents of the file (similar to the linux 'cat' program). Write...
1) Develop a C++ function that determines the average value of an array of type double...
1) Develop a C++ function that determines the average value of an array of type double elements double GetAverage(double array[], int size) The function should accept as input an array of double values The function should accept as input the number of elements in the array of double values The function should return a double value which is the array's average value 2) Develop a C++ function that determines the variance of an array of type double elements double GetVariance(double...
explain the relationship between a deep copy and its pointer. explain the relationship between a shallow...
explain the relationship between a deep copy and its pointer. explain the relationship between a shallow copy and its pointer. how many bytes are incremented if a pointer such as *p is incremented using pointer arithmetic such as (depending upon which primitive type it point to; int, double, char etc). write a copy constructor to copy a class object containing a dynamic array. use a member by member copy techniques shown in the textbook. using correct c++ syntax, write the...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n ==...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n == 0)    return 0; else    return n * f(n - 1); } A. 120 B. 60 C. 1 D. 0 10 points    QUESTION 2 Which of the following statements could describe the general (recursive) case of a recursive algorithm? In the following recursive function, which line(s) represent the general (recursive) case? void PrintIt(int n ) // line 1 { // line 2...
SanFrancisco Inc. manufactures computer supplies. San Francisco Inc. has variable expenses of $1.50 (for software) and...
SanFrancisco Inc. manufactures computer supplies. San Francisco Inc. has variable expenses of $1.50 (for software) and $2.00 (for hardware) per unit. Assume that total fixed expenses are 15,000. The devices are sold for $9 each. In the space below, first draw a blank “Break Even Chart/Graph” and then draw the fixed cost line. Draw the “Total Cost Line” and the “Total Revenue” line on the chart (HINT: Make sure these lines intersect) Now using the information provided above, calculate the...
C++ ONLY -- PRACTICE ASSIGNMENT For our practice assignment we have to turn in 2 files...
C++ ONLY -- PRACTICE ASSIGNMENT For our practice assignment we have to turn in 2 files - Driver.cpp and StringQueue.h Driver.cpp is provided for us, but if there are any changes needed to be made to that file please let me know. Based on the instructions below, what should the code look like for StringQueue.h ? Create a class named StringQueue in a file named StringQueue.h. Create a QueueNode structure as a private member of the class. The node should...
/* Write a function that looks for a particular person in their respective linked list The...
/* Write a function that looks for a particular person in their respective linked list The only place you need to write code is the "find" method in the linked list class */ #include <bits/stdc++.h> using namespace std; string ltrim(const string &); string rtrim(const string &); #define BUFFLEN 10 /* Each "person" is defined by their name, zipcode, and their pet's name. Persons are hashed by their zipcode. */ //---------------------------------------------------------------------------- /* function declarations ------------------------*/ int computeKey(int); void add_to_buffer(string,int,string); void find_in_buffer(int);...
The text's array-based queue implementations use the fixed-front approach. Group of answer choices True False Recall...
The text's array-based queue implementations use the fixed-front approach. Group of answer choices True False Recall that within the LinkedQueue the front and rear variables are of type LLNode<T> holding references to the front and rear nodes of the underlying linked list, and the numElements variable is an int and holds the current size of the queue. Which of the following code sequences could be used to correctly implement the isEmpty operation? Group of answer choices return (rear != null);...
Must be written in c++: This problem solely involves your demonstration of the proper usage of...
Must be written in c++: This problem solely involves your demonstration of the proper usage of C++ STL std::list<int> Below you will be given four total functions to develop (two are listed here, two separately after) Put all four of your functions in the same single source code file Submit ONLY your one source code CPP file online Submitting two or three or more separate CPP files will lose points (1) The first function you will need to implement is...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the following subsections can all go in one big file called pointerpractice.cpp. 1.1     Basics Write a function, int square 1(int∗ p), that takes a pointer to an int and returns the square of the int that it points to. Write a function, void square 2(int∗ p), that takes a pointer to an int and replaces that int (the one pointed to by p) with its...