In C++, you are implementing the vector class in the VectorStub zip. You need to implement all of the methods, and that’s it. You cannot add any new properties. Your solutions must conform to the Big O notations next to each method.
A few things to remember about templates:
- All the code is in the h file
- When testing a template, any method you don’t call gets deleted. So make sure you test them all, or you might secretly have one that doesn’t compile.
- If you make your Vector not a template (change all the T’s to int or something) it becomes easy to test as long as you remember to re-template it. (VS has trouble autocompleting a template since the code doesn’t exist yet.)
- I’m going to drop your vector in to my project, so don’t bother changing main unless you want to test something differently.
The hard part of this is the memory management, so take special care with Reserve, the constructors, and the destructor.
Vector.h
// I am going to match the names that STL uses so you don’t get confused in the real world. I’m skipping operator [] for a specific reason that
// doesn’t come up for a few weeks.
template<typename T>
class Vector
{
T* mData;
int mSize;
int mCapacity;// For testing purposes, initialize this to 15. Whenever you allocate new memory, double it.
T mUndefined;// Lots of STL functions say that doing something naughty gets “undefined behavior”. It could throw, crash, make you eggs, or return nonsense.
// Return this undefined one if anybody ever tries to go out of bounds.
public:
Vector()// O(1)
{
mSize = 0;
mData = nullptr;
}
Vector(const Vector<T>& tOther) : Vector()// O(n)
{
}
Vector &operator =(const Vector<T>& tRHS)// O(n)
{
return *this; // This line is weird so I’m just giving it to ya. It’s just the definition of an =
}
void PushBack(const T &tItem)// O(1)
{
// We take a const reference, but we _copy_ it in to our personal array.
}
void PopBack()// O(1)
{
}
void PushFront(const T &tItem)// O(n)
{
}
void PopFront()// O(n)
{
}
T& At(int tWhere)// O(1)
{
return mUndefined;
}
void Erase(int tWhere)// O(n)
{
// Keep an eye on this one. We’ll change its prototype next week
}
void Insert(int tWhere, const T& tWhat)// O(n)
{
// Keep an eye on this one. We’ll change its prototype next week
}
void Clear()// O(1)
{
}
int Size()// O(1)
{
return 0;
}
void Reserve(int tCount)// O(n)
{
}
int Capacity()// O(1)
{
return 0;
}
};
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In C You Are Implementing The Vector Class In The Vectorstub Zip You Need To Imp
/in Uncategorized /by developerIn C++, you are implementing the vector class in the VectorStub zip. You need to implement all of the methods, and that’s it. You cannot add any new properties. Your solutions must conform to the Big O notations next to each method.
A few things to remember about templates:
The hard part of this is the memory management, so take special care with Reserve, the constructors, and the destructor.
Vector.h
// I am going to match the names that STL uses so you don’t get confused in the real world. I’m skipping operator [] for a specific reason that
// doesn’t come up for a few weeks.
template<typename T>
class Vector
{
T* mData;
int mSize;
int mCapacity;// For testing purposes, initialize this to 15. Whenever you allocate new memory, double it.
T mUndefined;// Lots of STL functions say that doing something naughty gets “undefined behavior”. It could throw, crash, make you eggs, or return nonsense.
// Return this undefined one if anybody ever tries to go out of bounds.
public:
Vector()// O(1)
{
mSize = 0;
mData = nullptr;
}
Vector(const Vector<T>& tOther) : Vector()// O(n)
{
}
Vector &operator =(const Vector<T>& tRHS)// O(n)
{
return *this; // This line is weird so I’m just giving it to ya. It’s just the definition of an =
}
void PushBack(const T &tItem)// O(1)
{
// We take a const reference, but we _copy_ it in to our personal array.
}
void PopBack()// O(1)
{
}
void PushFront(const T &tItem)// O(n)
{
}
void PopFront()// O(n)
{
}
T& At(int tWhere)// O(1)
{
return mUndefined;
}
void Erase(int tWhere)// O(n)
{
// Keep an eye on this one. We’ll change its prototype next week
}
void Insert(int tWhere, const T& tWhat)// O(n)
{
// Keep an eye on this one. We’ll change its prototype next week
}
void Clear()// O(1)
{
}
int Size()// O(1)
{
return 0;
}
void Reserve(int tCount)// O(n)
{
}
int Capacity()// O(1)
{
return 0;
}
};
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Calculating The Cost Of Inventory For A Manufacturing Firm Explain The Criter
/in Uncategorized /by developerIn calculating the cost of inventory for a manufacturing firm, explain the criteria for deciding which costs are included or not included in the calculation. possibly an example to also help with explanation?
In calculating the cost of inventory for a manufacturing firm, explain the criteria for deciding whichcosts are included or not included in the calculation. possibly an example to also help with…
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Calculus Consider The Function Find Two Different Ways To Determine If The Li
/in Uncategorized /by developerIn Calculus:Consider the function . Find two different ways to determine if the limit as x approaches 2, exists for the above function. Contrast how the two methods are different and explain how they both arrive at the same conclusion. Is this function continuous? Justify your answer. (Function attached as .jpeg)
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Capital Budgeting Analyses At Time 0 Firm Builds Up Inventory When Inventory
/in Uncategorized /by developerIn capital budgeting analyses, at time 0 firm builds up inventory. When inventory increases, cash should drop (suppose use cash to pay), and current assets remain the same. Why the net working capital increases (indicating cash outflow)? I understood the cash outflow part, but not clear about the increase in net working capital.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Cell C9 Enter A Database Function To Calculate The Total Value Of Monthly Ren
/in Uncategorized /by developerIn cell I4 insert a financial function to calculate the present value of the total monthly rent you will collect for the 8 units for 30 years. Use the number of periods and monthly rate in the Summary Calculations section and the cell references in the What If section. The result should be a positive value.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Cell J5 Create A Vlookup Function That Returns The Salesperson Commission Tha
/in Uncategorized /by developerIn cell J5, create a VLOOKUP function that returns the salesperson commission that corresponds with the base cost of the car (in F5). Use the range $C$24:$D$28 as the Lookup Table, and return the commission rate from Column 2.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Cellular Respiration Stored Chemical Energy In A Atp And Nadh Is Converted To
/in Uncategorized /by developerIn cellular respiration, stored chemical energy in
a. ATP and NADH is converted to carbohydrate molecules
b. ATP molecules is used to build NADH molecule
d. organic molecules is converted to ATP molecules
c. food is used to make organic molecules like glucose
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Certain Type Of Mouse Gray Is Produced When A White Mouse Is Crossed With A B
/in Uncategorized /by developerin certain type of mouse, gray is produced when a white mouse is crossed with a black mouse. This is a type of incomplete dominance. If two gray mice are crossed, what will the offspring phenotypes be?
a. 75% gray, 25% white
b. 75% white, 25% gray
c. 75% black, 25% white
d. 25% black, 50% gray, 25% white
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Chapter 1 Of Dick Carey S Book On Page 4 Constructivism Is Mentioned Define C 1
/in Uncategorized /by developerIn Chapter 1 of Dick & Carey’s book on page 4, constructivism is mentioned. Define constructivism and behaviorism and find one article from the Keiser library about the constructivist approach and one article about the behaviorist approach. Choose one instructional goal from your field or discipline of healthcare (or one you are interested in) and state which of these two approaches you would choose if you were designing instruction for the goal.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
In Chapter 1 The Author Presents Several Use Cases For Blockchain Technology Des
/in Uncategorized /by developerIn chapter 1, the author presents several use cases for blockchain technology. Describe the use case that aligns most closely with your current job role, including how blockchain technology would change things that you currently do in your job. If you are not working in a job role that aligns nicely with a use case presented in chapter 1, describe a job role that you would like to hold after finishing your degree program, and how blockchain technology may affect those job functions.
Note: My Job role is Programmer Analyst. and company name is Pharmacy company(Pfizer)
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"