add hw3 solution
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
HOMEWORK 3: MATRIX CLASS
|
||||
|
||||
|
||||
NAME: < insert name >
|
||||
NAME: Jinshan Zhou
|
||||
|
||||
|
||||
COLLABORATORS AND OTHER RESOURCES:
|
||||
@@ -10,13 +10,13 @@ List the names of everyone you talked to about this assignment
|
||||
LMS, etc.), and all of the resources (books, online reference
|
||||
material, etc.) you consulted in completing this assignment.
|
||||
|
||||
< insert collaborators / resources >
|
||||
cmath fabs method. Lecture notes about ** pointers and destructors.
|
||||
|
||||
Remember: Your implementation for this assignment must be done on your
|
||||
own, as described in "Academic Integrity for Homework" handout.
|
||||
|
||||
|
||||
ESTIMATE OF # OF HOURS SPENT ON THIS ASSIGNMENT: < insert # hours >
|
||||
ESTIMATE OF # OF HOURS SPENT ON THIS ASSIGNMENT: 14 hr
|
||||
|
||||
|
||||
|
||||
@@ -27,25 +27,25 @@ number of columns. You should assume that calling new [] or delete []
|
||||
on an array will take time proportional to the number of elements in
|
||||
the array.
|
||||
|
||||
get
|
||||
get -> O(1)
|
||||
|
||||
set
|
||||
set -> O(1)
|
||||
|
||||
num_rows
|
||||
num_rows -> O(1)
|
||||
|
||||
get_column
|
||||
get_column -> O(m)
|
||||
|
||||
operator<<
|
||||
operator<< -> O(m*n)
|
||||
|
||||
quarter
|
||||
quarter -> O(m*n)
|
||||
|
||||
operator==
|
||||
operator== -> O(m*n)
|
||||
|
||||
operator!=
|
||||
operator!= -> O(m*n)
|
||||
|
||||
swap_rows
|
||||
swap_rows -> O(1)
|
||||
|
||||
rref (provided in matrix_main.cpp)
|
||||
rref (provided in matrix_main.cpp) -> O(m^2 * n)
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,17 @@ What tools did you use (gdb/lldb/Visual Studio debugger,
|
||||
Valgrind/Dr. Memory, std::cout & print, etc.)? How did you test the
|
||||
"corner cases" of your Matrix class design & implementation?
|
||||
|
||||
I used gdb inside VSCode to debug my program. I also used the information
|
||||
from the submitty autograder (Dr. Memory) to help me find bugs in my code.
|
||||
I basiclly find what's name and function of the methods of Martix class,
|
||||
and change my code bit by bit to fit the expected output.
|
||||
|
||||
MISC. COMMENTS TO GRADER:
|
||||
(optional, please be concise!)
|
||||
|
||||
REFLECTION:
|
||||
As the pointer adding up, the complexity of the program will increase.
|
||||
I think it is important to understand where do pointers points to and
|
||||
delete them when they are not needed anymore. It's quiet tricky and I
|
||||
got a lot of memory leaks in my code at first. But the error message in
|
||||
Dr. Memory shows which line caused the problem, so I was able to fix it.
|
||||
Reference in New Issue
Block a user