when writing a program and storing a .txt file that contains data into the follo
ID: 3769736 • Letter: W
Question
when writing a program and storing a .txt file that contains data into the following four function1-unsorted linked list function 2-sorted list function 3-unsorted array function 4-sorted array function which of the four functions is the most efficient. when writing a program and storing a .txt file that contains data into the following four function
1-unsorted linked list function 2-sorted list function 3-unsorted array function 4-sorted array function which of the four functions is the most efficient. 1-unsorted linked list function 2-sorted list function 3-unsorted array function 4-sorted array function 1-unsorted linked list function 2-sorted list function 3-unsorted array function 4-sorted array function which of the four functions is the most efficient.
Explanation / Answer
sorted array function is the most efficient
Reason;
arrays are most effiecient than list in terms of accessing the location of a data element hence first two are out
sorted data elements are more benefical than unsorted data elements for eg. If you want to find the mode (statistical mode) of the array of elements then unsorted array takes O(n2) but sorted array will take only O(n) time.
hence (d) is the answer.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.