Data Structures and Algorithm Analysis: Java implementation for Matrix

Verified

Added on  2019/09/23

|2
|453
|568
Homework Assignment
AI Summary
This assignment delves into the application of data structures and algorithms for matrix calculations, specifically using Java. The student explores the use of a linked list data structure, analyzing its performance and suitability compared to other options like 2D arrays. The assignment covers the implementation of a matrix determinant calculation, including the use of recursion and considerations for time and space complexity. Furthermore, the student discusses the efficiency of the chosen algorithm, potential improvements, and lessons learned from the implementation, including file input/output operations and the advantages and disadvantages of using linked lists. The student also reflects on the use of recursion and how to improve the implementation using other data structures and their impact on the performance.
Document Page
1. Justification of other data structures and design issues
Ans: 2 Dimensional array data structure is also a good option to use it, It’s better for
performance as it has random access. Array has contiguous memory allocation and thus we can
access it randomly. So Ii has fast access and can beneficial when size of matrix is so large.
2. Description of stack implementation and justification for choice
Ans: Linked list based stack is an option for calculating the determinant for matrix of different
order. As linked list is data structure which uses memory chunks which are not contiguous so it
an memory saver data structure and give as better performance in terms of memory.
3. Discuss stacks - Was it a good choice for this lab?
Ans: Performance wise it’s not best but considering the memory it is an good option.
4. Discussion of algorithm efficiency – time complexity
Ans: Time complexity of this algo is size of list * complexity for recursive call to calculate the
minor matrix. Recursive call for calculating minor would be linear. So complexity should be
O(n*n) i.e. O(n^2)
5. Discussion of algorithm efficiency - space complexity
Ans: Space complexity is size of node * number of node.
6. Potential use of recursion
Ans: Solution is recursive as its being calculated by calling minor matrices. Minor matrix is size
smaller than parent matrix. This would be done until we get 1X1 matrix.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7. What did you learn?
Ans:
Linked list: Linked list is being used for storing matrix. So I have learned what is the various way
of implementing it and what all can be stored in linked list. It’s one of the data structures which
can be used where we don’t need random access of data.
Recursion: I have used recursion in this implementation. Recursion in computer science is a
method where the solution to a problem depends on solutions to smaller instances of the same
problem
Writing and reading file: Input for the program is being taken as file and output is being written
in file. So I have learned how to read and write to file from java program.
8. What would you do differently next time?
Ans: Try to use some other data structures instead of Linked List. I can come to know what
challenges I can face when try to implement this problem in those. By that I can come to know
when we should use which data structure.
chevron_up_icon
1 out of 2
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]