Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Big O Notation with Absolute Value?

I'm going through some programming interview question books, and I've seen reference to "O(|A|)" time complexity. I've never seen this notation with the absolute value given.

Some research led me to Big O Cheatsheet that references this notation under the graphs section. The problem I'm researching is about partitioning an array, which isn't really a graph question (though I risk perhaps showing my ignorance with that statement).

Does |A| refer to the magnitude of the array, or otherwise number of elements, i.e. O(N)?

like image 830
Jay Kint Avatar asked Mar 16 '23 16:03

Jay Kint


1 Answers

In set theory notation |A| is the cardinality of set A, in other words the number of elements contained in set A.

For Reference: http://www.mathsisfun.com/sets/symbols.html

like image 192
Kostub Deshmukh Avatar answered Mar 24 '23 07:03

Kostub Deshmukh