C++ project - Computer Science
Need to do project in c++
#include <iostream>
using namespace std;
template <class T> class Entry {
private:
int row;
int col;
T value;
public:
Entry() {
row = -1;
col = -1;
}
Entry(int row, int col, T value) {
this->row = row;
this->col = col;
this->value = value;
}
Entry(const Entry& other) {
row = other.row;
col = other.col;
value = other.value;
}
Entry& operator=(const Entry& other) {
row = other.row;
col = other.col;
value = other.value;
return *this;
}
int getRow() { return row; }
int getCol() { return col; }
T getValue() { return value; }
void setValue(T value) { this->value = value; }
};
#include <exception>
using namespace std;
class NoSuchEntry : public exception {
public:
virtual const char* what() const throw() {
return "No entry exists at this location";
}
};
#include <iostream>
#include "SparseMatrix.h"
using namespace std;
template <class T> void printState(const SparseMatrix<T>& matrix) {
cout << matrix << endl;
cout << "rows = " << matrix.getNumRows() << endl;
cout << "cols = " << matrix.getNumCols() << endl;
cout << "numEntries = " << matrix.getNumEntries() << endl;
cout << endl;
}
int main() {
cout << "Initial creation" << endl;
SparseMatrix<int> matrix;
printState(matrix);
cout << "Fresh add" << endl;
matrix.add(0, 0, 4);
printState(matrix);
cout << "Another fresh add" << endl;
matrix.add(4, 1, 10);
printState(matrix);
cout << "One more fresh add" << endl;
matrix.add(3, 5, 10);
printState(matrix);
cout << "Overwrite add" << endl;
matrix.add(0, 0, 9);
printState(matrix);
cout << "Invalid remove" << endl;
try {
matrix.remove(1, 5);
} catch (NoSuchEntry& e) {
cout << e.what() << endl << endl;
}
cout << "Valid remove (last add)" << endl;
matrix.remove(3, 5);
printState(matrix);
cout << "Valid remove (not last add)" << endl;
matrix.remove(0, 0);
printState(matrix);
cout << "Copy constructor" << endl;
SparseMatrix<int> copy1(matrix);
cout << "Done with copy constructor" << endl;
copy1.add(2, 1, 6);
printState(copy1);
printState(matrix);
cout << "Assignment operator (fresh assignment)" << endl;
SparseMatrix<int> copy2 = matrix;
copy2.add(1, 1, 7);
printState(copy2);
printState(matrix);
cout << "Assignment operator (overwriting assignment)" << endl;
copy2 = matrix;
copy2.add(2, 2, 9);
printState(copy2);
printState(matrix);
cout << "Template" << endl;
SparseMatrix<char> otherMatrix;
otherMatrix.add(0, 0, 'A');
printState(otherMatrix);
}
#include <exception>
#include <iostream>
#include "Entry.h"
#include "NoSuchEntry.h"
using namespace std;
template <class T>
class SparseMatrix {
private:
Entry<T>** entries;
int capacity;
int size;
public:
SparseMatrix() {
}
SparseMatrix(const SparseMatrix& other) {
}
SparseMatrix& operator=(const SparseMatrix& other) {
}
~SparseMatrix() {
}
void add(int row, int col, T value) {
}
void remove(int row, int col) {
}
T getValue(int row, int col) const {
}
int getNumEntries() const {
}
int getNumRows() const {
}
int getNumCols() const {
}
template <class U>
friend ostream& operator<<(ostream& os, const SparseMatrix<U>& sm);
};
template <class U>
ostream& operator<<(ostream& os, const SparseMatrix<U>& sm) {
}
Initial creation
rows = 0
cols = 0
numEntries = 0
Fresh add
4
rows = 1
cols = 1
numEntries = 1
Another fresh add
4 -
- -
- -
- -
- 10
rows = 5
cols = 2
numEntries = 2
One more fresh add
4 - - - - -
- - - - - -
- - - - - -
- - - - - 10
- 10 - - - -
rows = 5
cols = 6
numEntries = 3
Overwrite add
9 - - - - -
- - - - - -
- - - - - -
- - - - - 10
- 10 - - - -
rows = 5
cols = 6
numEntries = 3
Invalid remove
No entry exists at this location
Valid remove (last add)
9 -
- -
- -
- -
- 10
rows = 5
cols = 2
numEntries = 2
Valid remove (not last add)
- -
- -
- -
- -
- 10
rows = 5
cols = 2
numEntries = 1
Copy constructor
Done with copy constructor
- -
- -
- 6
- -
- 10
rows = 5
cols = 2
numEntries = 2
- -
- -
- -
- -
- 10
rows = 5
cols = 2
numEntries = 1
Assignment operator (fresh assignment)
- -
- 7
- -
- -
- 10
rows = 5
cols = 2
numEntries = 2
- -
- -
- -
- -
- 10
rows = 5
cols = 2
numEntries = 1
Assignment operator (overwriting assignment)
- - -
- - -
- - 9
- - -
- 10 -
rows = 5
cols = 3
numEntries = 2
- -
- -
- -
- -
- 10
rows = 5
cols = 2
numEntries = 1
Template
A
rows = 1
cols = 1
numEntries = 1
CS 3100 – Data Structures and Algorithms
Project #1 – Sparse Matrix
Learning Objectives
• Apply basic object-oriented programming concepts in C++
• Construct and use C++ objects making effective use of references and pointers
• Implement an abstract data type conforming to specific design specifications
Overview
Your task for this assignment is to implement a “Sparse Matrix” data type. A matrix is a two-
dimensional array. The term sparse means that most of the slots in the array are empty. A novice
programmer might store this type of data structure by simply creating a two-dimensional array of the
appropriate data type, but this would waste a lot of space since most of the memory allocated would
not be holding any value due to the sparsity of the matrix. A much better implementation is to keep a
list (either as an array or a linked list) of the non-empty slot. Entries can be represented as objects of an
Entry class, that contains fields for the row and column of this entry in the sparse matrix, as well as its
value. Since a data structure generally needs to be able to store values of any data type, the Entry class
is a template. You have been provided with the code for this class on Pilot.
You have given a SparseMatrix.h file with method prototypes for the sparse matrix (this is on
Pilot). Your task is to implement the methods according to the following specifications. You may add
any supplementary methods that you would like, but the only ones that are absolutely required are
those already present in the file. You have been provided with a file called test.cpp, and the expected
output (output.txt) to partially check you work. Please keep in mind that we will use a different test file
when grading, so you might want to develop your own additional tests to make sure your
implementation is robust.
You can implement the sparse matrix using an array, a linked list, or any other data structure that you
feel is appropriate. Because this is a data structures class, you need to design and implement the
underlying data structure yourself. You may not, for example, use C++ standard template library vectors
(or any other existing code) for the underlying data structure. Failure to follow this requirement will
result in a zero on the project, so please contact me if you have any questions.
The Sparse Matrix
The sparse matrix data type will be implemented as follows:
• Default constructor – creates a new sparse matrix that contains no entries
• Copy constructor – creates an independent copy of the other sparse matrix
• Assignment operator overload – creates an independent copy of the other sparse matrix
without leaking any memory
• Destructor – destroys the sparse matrix without leaking any memory
• void add(int row, int col, T value) – adds the value to the specified row and column of the sparse
matrix, overwriting an existing entry if one is already present at that location (without leaking
any memory); there should be no limit on the number of entries that can be added, within the
bounds of the available RAM
• void remove(int row, int col) – clears the entry at the indicated row and column without leaking
any memory; if there is no entry at the specified row and column, throw a NoSuchEntry
exception (you have been provided with this class in the file NoSuchEntry.h on Pilot).
• T getValue(int row, int col) – returns the value of the entry at the indicated row and column;
throws a NoSuchEntry exception if there is no entry there.
• int getNumRows() – returns the number of rows in the sparse matrix (i.e. the row of the largest
entry in the matrix plus one)
• int getNumCols() – returns the number of columns in the sparse matrix (i.e. the column of the
largest entry in the matrix plus one)
• int getNumEntries() – returns the number of non-empty elements in the sparse matrix
• << operator overload – displays the sparse matrix as a two-dimensional array, with empty slots
indicated by a hyphen
Turn in and Grading
Please implement your class in-line in the SparseMatrix.h file provided (do not make a separate .cpp
file). Turn in any source code required to build and run your implementation. This likely includes
SparseMatrix.h, Entry.h and NoSuchEntry.h. Do not turn in test.cpp. You may turn in your files either
individually or zipped into a single file.
Your project will be graded according to the following rubric. Each item is worth 10 points, for a total of
100. Projects that do not compile will receive a zero. Projects that use classes from the standard
template library (STL) or any other existing library, such as the vector or list classes, will also receive a
zero.
You can create a sparse matrix of any data types and insert values into the matrix at new locations.
Inserting a value into a sparse matrix where one is already present overwrites the old value and does
not introduce a memory leak.
The capacity of the sparse matrix is limited only by the amount of available RAM (note, there is no test
for this in the driver program provided).
You can remove an item from a specified row and column within the sparse matrix without introducing a
memory leak; trying to remove an item from an empty location throws a NoSuchEntry exception.
You can retrieve the value (via getValue) from a specified row and column within the sparse matrix;
trying to get a value from an empty location throws a NoSuchEntry exception.
The getNumRows, getNumCols and getNumEntries methods return accurate values, including for an
empty sparse matrix.
You can print sparse matrices to cout in the format specified in the requirements above using <<
A sparse matrix can be copied (using a copy constructor) resulting in a new, independent matrix with the
same contents as the original matrix.
A sparse matrix can be assigned (using =), resulting in a new, independent matrix with the same
contents as the original matrix. This works for both initial assignments and re-assignments and does not
introduce any memory leaks.
Your code follows standard coding conventions, including consistent indentation and meaningful
identifier names. Any tricky parts of the implementation are clearly commented. Your code does not
print out any extraneous debugging information when it is run.
CATEGORIES
Economics
Nursing
Applied Sciences
Psychology
Science
Management
Computer Science
Human Resource Management
Accounting
Information Systems
English
Anatomy
Operations Management
Sociology
Literature
Education
Business & Finance
Marketing
Engineering
Statistics
Biology
Political Science
Reading
History
Financial markets
Philosophy
Mathematics
Law
Criminal
Architecture and Design
Government
Social Science
World history
Chemistry
Humanities
Business Finance
Writing
Programming
Telecommunications Engineering
Geography
Physics
Spanish
ach
e. Embedded Entrepreneurship
f. Three Social Entrepreneurship Models
g. Social-Founder Identity
h. Micros-enterprise Development
Outcomes
Subset 2. Indigenous Entrepreneurship Approaches (Outside of Canada)
a. Indigenous Australian Entrepreneurs Exami
Calculus
(people influence of
others) processes that you perceived occurs in this specific Institution Select one of the forms of stratification highlighted (focus on inter the intersectionalities
of these three) to reflect and analyze the potential ways these (
American history
Pharmacology
Ancient history
. Also
Numerical analysis
Environmental science
Electrical Engineering
Precalculus
Physiology
Civil Engineering
Electronic Engineering
ness Horizons
Algebra
Geology
Physical chemistry
nt
When considering both O
lassrooms
Civil
Probability
ions
Identify a specific consumer product that you or your family have used for quite some time. This might be a branded smartphone (if you have used several versions over the years)
or the court to consider in its deliberations. Locard’s exchange principle argues that during the commission of a crime
Chemical Engineering
Ecology
aragraphs (meaning 25 sentences or more). Your assignment may be more than 5 paragraphs but not less.
INSTRUCTIONS:
To access the FNU Online Library for journals and articles you can go the FNU library link here:
https://www.fnu.edu/library/
In order to
n that draws upon the theoretical reading to explain and contextualize the design choices. Be sure to directly quote or paraphrase the reading
ce to the vaccine. Your campaign must educate and inform the audience on the benefits but also create for safe and open dialogue. A key metric of your campaign will be the direct increase in numbers.
Key outcomes: The approach that you take must be clear
Mechanical Engineering
Organic chemistry
Geometry
nment
Topic
You will need to pick one topic for your project (5 pts)
Literature search
You will need to perform a literature search for your topic
Geophysics
you been involved with a company doing a redesign of business processes
Communication on Customer Relations. Discuss how two-way communication on social media channels impacts businesses both positively and negatively. Provide any personal examples from your experience
od pressure and hypertension via a community-wide intervention that targets the problem across the lifespan (i.e. includes all ages).
Develop a community-wide intervention to reduce elevated blood pressure and hypertension in the State of Alabama that in
in body of the report
Conclusions
References (8 References Minimum)
*** Words count = 2000 words.
*** In-Text Citations and References using Harvard style.
*** In Task section I’ve chose (Economic issues in overseas contracting)"
Electromagnetism
w or quality improvement; it was just all part of good nursing care. The goal for quality improvement is to monitor patient outcomes using statistics for comparison to standards of care for different diseases
e a 1 to 2 slide Microsoft PowerPoint presentation on the different models of case management. Include speaker notes... .....Describe three different models of case management.
visual representations of information. They can include numbers
SSAY
ame workbook for all 3 milestones. You do not need to download a new copy for Milestones 2 or 3. When you submit Milestone 3
pages):
Provide a description of an existing intervention in Canada
making the appropriate buying decisions in an ethical and professional manner.
Topic: Purchasing and Technology
You read about blockchain ledger technology. Now do some additional research out on the Internet and share your URL with the rest of the class
be aware of which features their competitors are opting to include so the product development teams can design similar or enhanced features to attract more of the market. The more unique
low (The Top Health Industry Trends to Watch in 2015) to assist you with this discussion.
https://youtu.be/fRym_jyuBc0
Next year the $2.8 trillion U.S. healthcare industry will finally begin to look and feel more like the rest of the business wo
evidence-based primary care curriculum. Throughout your nurse practitioner program
Vignette
Understanding Gender Fluidity
Providing Inclusive Quality Care
Affirming Clinical Encounters
Conclusion
References
Nurse Practitioner Knowledge
Mechanics
and word limit is unit as a guide only.
The assessment may be re-attempted on two further occasions (maximum three attempts in total). All assessments must be resubmitted 3 days within receiving your unsatisfactory grade. You must clearly indicate “Re-su
Trigonometry
Article writing
Other
5. June 29
After the components sending to the manufacturing house
1. In 1972 the Furman v. Georgia case resulted in a decision that would put action into motion. Furman was originally sentenced to death because of a murder he committed in Georgia but the court debated whether or not this was a violation of his 8th amend
One of the first conflicts that would need to be investigated would be whether the human service professional followed the responsibility to client ethical standard. While developing a relationship with client it is important to clarify that if danger or
Ethical behavior is a critical topic in the workplace because the impact of it can make or break a business
No matter which type of health care organization
With a direct sale
During the pandemic
Computers are being used to monitor the spread of outbreaks in different areas of the world and with this record
3. Furman v. Georgia is a U.S Supreme Court case that resolves around the Eighth Amendments ban on cruel and unsual punishment in death penalty cases. The Furman v. Georgia case was based on Furman being convicted of murder in Georgia. Furman was caught i
One major ethical conflict that may arise in my investigation is the Responsibility to Client in both Standard 3 and Standard 4 of the Ethical Standards for Human Service Professionals (2015). Making sure we do not disclose information without consent ev
4. Identify two examples of real world problems that you have observed in your personal
Summary & Evaluation: Reference & 188. Academic Search Ultimate
Ethics
We can mention at least one example of how the violation of ethical standards can be prevented. Many organizations promote ethical self-regulation by creating moral codes to help direct their business activities
*DDB is used for the first three years
For example
The inbound logistics for William Instrument refer to purchase components from various electronic firms. During the purchase process William need to consider the quality and price of the components. In this case
4. A U.S. Supreme Court case known as Furman v. Georgia (1972) is a landmark case that involved Eighth Amendment’s ban of unusual and cruel punishment in death penalty cases (Furman v. Georgia (1972)
With covid coming into place
In my opinion
with
Not necessarily all home buyers are the same! When you choose to work with we buy ugly houses Baltimore & nationwide USA
The ability to view ourselves from an unbiased perspective allows us to critically assess our personal strengths and weaknesses. This is an important step in the process of finding the right resources for our personal learning style. Ego and pride can be
· By Day 1 of this week
While you must form your answers to the questions below from our assigned reading material
CliftonLarsonAllen LLP (2013)
5 The family dynamic is awkward at first since the most outgoing and straight forward person in the family in Linda
Urien
The most important benefit of my statistical analysis would be the accuracy with which I interpret the data. The greatest obstacle
From a similar but larger point of view
4 In order to get the entire family to come back for another session I would suggest coming in on a day the restaurant is not open
When seeking to identify a patient’s health condition
After viewing the you tube videos on prayer
Your paper must be at least two pages in length (not counting the title and reference pages)
The word assimilate is negative to me. I believe everyone should learn about a country that they are going to live in. It doesnt mean that they have to believe that everything in America is better than where they came from. It means that they care enough
Data collection
Single Subject Chris is a social worker in a geriatric case management program located in a midsize Northeastern town. She has an MSW and is part of a team of case managers that likes to continuously improve on its practice. The team is currently using an
I would start off with Linda on repeating her options for the child and going over what she is feeling with each option. I would want to find out what she is afraid of. I would avoid asking her any “why” questions because I want her to be in the here an
Summarize the advantages and disadvantages of using an Internet site as means of collecting data for psychological research (Comp 2.1) 25.0\% Summarization of the advantages and disadvantages of using an Internet site as means of collecting data for psych
Identify the type of research used in a chosen study
Compose a 1
Optics
effect relationship becomes more difficult—as the researcher cannot enact total control of another person even in an experimental environment. Social workers serve clients in highly complex real-world environments. Clients often implement recommended inte
I think knowing more about you will allow you to be able to choose the right resources
Be 4 pages in length
soft MB-920 dumps review and documentation and high-quality listing pdf MB-920 braindumps also recommended and approved by Microsoft experts. The practical test
g
One thing you will need to do in college is learn how to find and use references. References support your ideas. College-level work must be supported by research. You are expected to do that for this paper. You will research
Elaborate on any potential confounds or ethical concerns while participating in the psychological study 20.0\% Elaboration on any potential confounds or ethical concerns while participating in the psychological study is missing. Elaboration on any potenti
3 The first thing I would do in the family’s first session is develop a genogram of the family to get an idea of all the individuals who play a major role in Linda’s life. After establishing where each member is in relation to the family
A Health in All Policies approach
Note: The requirements outlined below correspond to the grading criteria in the scoring guide. At a minimum
Chen
Read Connecting Communities and Complexity: A Case Study in Creating the Conditions for Transformational Change
Read Reflections on Cultural Humility
Read A Basic Guide to ABCD Community Organizing
Use the bolded black section and sub-section titles below to organize your paper. For each section
Losinski forwarded the article on a priority basis to Mary Scott
Losinksi wanted details on use of the ED at CGH. He asked the administrative resident