Algorithm Analysis
I am studying for my Algorithm Analysis class, i need to fill in this table:
Operation:
Finding a particular item
Finding the ith element
Finding the maximum item
Adding an item
Deleting a particular item
for: Unsorted array, Sorted array, Unsorted linked list, Sorted linked list
the different levels of compelxcity are:
O(k)
O(lg N)
O(N)
O(N lg N)
O(N2)
O(N3)
O(Nk)
O(2N)
For all of these i am looking for the worst case.
Finding item,Finding ith element,Finding maximum item,Adding an item,Delete item
So far here is what i have, in the order listed above:
Unsorted array : O(N),O(k),O(N),O(k), O(N)
Sorted array : O(lg N),O(k),O(k),O(N), O(N)
Unsorted linked list : O(N),O(N),O(N),O(k), O(k)
Sorted linked list : O(N),O(N),O(k),O(N), O(k)
Sorry if this is hard to read, i am not sure how to put a chart into a post. If anyone could point out any mistakes, or confirm my results that would be great, Thanks.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement