Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

I have come across datastructures and I found complexity O(1), O(n), O(log n), O(n log n) and O(n2)?

$
0
0

when you enter into Datastructure you first see Complexity of an algorithm , O(1), O(n), O(log n), O(n log n) and O(n2).

I see

O(1) is constant complexity, therefore when you access a Property inside a class right ?

ex: List<T> class Count property

O(n) - complexity is number of items in the collection

ex: for loop the collection

but I could not understand O(log n) and O(n log n), O(n2) could you please give me a clear explation about those ?

NOTE: I found BinaryTree<T> contains method has O(log n) complexity but how ?


Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>