Tutorial by Examples: big

Big O notation provides upper bounds for the growth of functions. Intuitively for f ∊ O(g), f grows at most as fast as g. Formally f ∊ O(g) if and only if there is a positive number C and a positive number ``n such that for all positive numbers m > n we have C⋅g(m) > f(m). Intuition of ...
The BigInteger class has a constructor dedicated to generate random BigIntegers, given an instance of java.util.Random and an int that specifies how many bits will the BigInteger have. Its usage is quite simple - when you call the constructor BigInteger(int, Random) like this: BigInteger randomBigI...
Due to way that the float type is represented in computer memory, results of operations using this type can be inaccurate - some values are stored as approximations. Good examples of this are monetary calculations. If high precision is necessary, other types should be used. e.g. Java 7 provides Big...
Go to the BigCommerce homepage. Enter a store name in the field labeled Create your store name, then click Start my free trial now. Your store name can be changed at any time after starting your trial. Fill out the new trial store form, then click Create my store now. Once yo...
Small files are processed in a fraction of second and you can read / write them in place of the code where you need this. However if the file is bigger or otherwise slower to process, you may need to use AsyncTask in Android to work with the file in the background: class FileOperation extends A...
The BigDecimal class contains an internal cache of frequently used numbers e.g. 0 to 10. The BigDecimal.valueOf() methods are provided in preference to constructors with similar type parameters i.e. in the below example a is preferred to b. BigDecimal a = BigDecimal.valueOf(10L); //Returns cached O...
BigDecimal provides static properties for the numbers zero, one and ten. It's good practise to use these instead of using the actual numbers: BigDecimal.ZERO BigDecimal.ONE BigDecimal.TEN By using the static properties, you avoid an unnecessary instantiation, also you've got a literal in you...
A frequent question about StackViews inside Scrollviews comes from ambiguous with/heigh alerts on interface builder. As this answer explained, it is necessary to: Add in the UIScrollView a UIView (the contentScrollView); In this contentScrollView, set top, bottom, left and right margins to 0 Se...
In case of big data sets, the call of grepl("fox", test_sentences) does not perform well. Big data sets are e.g. crawled websites or million of Tweets, etc. The first acceleration is the usage of the perl = TRUE option. Even faster is the option fixed = TRUE. A complete example would be: ...
Say you're introducing a class of types that have a size in bytes. class SizeOf a where sizeOf :: a -> Int The problem is that the size should be constant for every value of that type. We don't actually want the sizeOf function to depend on a, but only on it's type. Without type applica...

Page 2 of 2