71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
HOMEWORK 3: MATRIX CLASS
|
|
|
|
|
|
NAME: Jinshan Zhou
|
|
|
|
|
|
COLLABORATORS AND OTHER RESOURCES:
|
|
List the names of everyone you talked to about this assignment
|
|
(classmates, TAs, ALAC tutors, upperclassmen, students/instructor via
|
|
LMS, etc.), and all of the resources (books, online reference
|
|
material, etc.) you consulted in completing this assignment.
|
|
|
|
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: 14 hr
|
|
|
|
|
|
|
|
ORDER NOTATION:
|
|
For each of the functions below, write the order notation O().
|
|
Write each answer in terms of m = the number of rows and n = the
|
|
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 -> O(1)
|
|
|
|
set -> O(1)
|
|
|
|
num_rows -> O(1)
|
|
|
|
get_column -> O(m)
|
|
|
|
operator<< -> O(m*n)
|
|
|
|
quarter -> O(m*n)
|
|
|
|
operator== -> O(m*n)
|
|
|
|
operator!= -> O(m*n)
|
|
|
|
swap_rows -> O(1)
|
|
|
|
rref (provided in matrix_main.cpp) -> O(m^2 * n)
|
|
|
|
|
|
|
|
TESTING & DEBUGGING STRATEGY:
|
|
Discuss your strategy for testing & debugging your program.
|
|
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. |