English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

(programming language)

2007-02-06 04:46:30 · 4 answers · asked by graze 3 in Computers & Internet Programming & Design

4 answers

It uses what is called big Oh notation ( O(n) ) to give a general idea of how fast an algorithm is, and provides a standard of comparing algorithm speed. For example, it makes sense so say an algorithm with complexity O(n) is better than O(n^2). It does not make sense to say algorithm 1 run in 13 milliseconds when n is 5 and algorithm 2 runs in 33 milliseconds when n is 5. That statement tells you nothing about 1 and 2 perform as n increases.

2007-02-06 08:06:50 · answer #1 · answered by Pfo 7 · 0 0

some effortless algorithms that are O(log n) are algorithms for searching in ordered structures. this can be the case for binary seek for (ordered list) and fairly a lot any operation on a binary seek for tree. the reason that you get a log contained in the complexity is that you *many times decrease the quest area with assistance from a consistent component*. So evaluate a binary seek for for value x in a itemizing of length n. One generation of the loop tests the middle value of the list and figures out if x is below or more effective than the middle value (if it is no longer equivalent). In both case, you could continuously eliminate 1/2 of the values contained in the list--you decrease the type of a threat places contained in the list with assistance from a portion of two. evaluate the case the position x isn't contained in the list. Then the type of iterations contained in the loop is determined with assistance from the type of time you could divide the size of the list with assistance from 2 in the previous you get the empty list. it truly is an identical as log2(n).

2016-11-02 12:06:30 · answer #2 · answered by ? 4 · 0 0

I don't know what you are asking about. Your question complexity should be O(n²). And the time complexity of your question migh O(n³ log n).

2007-02-06 05:27:33 · answer #3 · answered by oohay_member_directory 4 · 0 1

Minimal always.

2007-02-06 04:58:38 · answer #4 · answered by Knowledge 3 · 1 0

fedest.com, questions and answers