0

Here are my questionsand my answers. Could you guys/gals tell me if i am right or wrong?
Which array-based operations are O(1)?
inserting item or deleting item in unsorted array

Which linked-list operations are O(1)?
inserting and deleteing item in unsorted lsit

Which array-based operations are O(n)?
traversing through the list or adding or deleting in a sorted array

Which linked-list operations are O(n)?
traversing through the list or adding or deleting in a sorted list

so what do you think i am right or wrong or is there anything else?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by corby
0

>>Which array-based operations are O(1)?
>>inserting item or deleting item in unsorted array

not quite, what happens if we insert in the middle of the array. How about accessing the data?

>>Which linked-list operations are O(1)?
>>inserting and deleteing item in unsorted lsit
true.

>>Which array-based operations are O(n)?
>>traversing through the list or adding or deleting in a sorted array
its asking you about arrays, why are you mentioning lists?
Whats the difference from "adding" in an array then "inserting" in an array?
In general, inserting and deleting can take up O(n).

>>Which linked-list operations are O(n)?
traversing through the list or adding or deleting in a sorted list
true.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.