valgrind --leak-check=yes myprog
valgrind --tool=callgrind
kcachegrind: Graphical interface taking callgrind.out.*
.
# SOURCES=my_main.cpp INC_PATH=~/tools/ImageMagick-6.6.5-4/Magick++/lib LIBRARY_PATH=~/tools/ImageMagick-6.6.5-4/Magick++/bin all: g++ -g -L$(LIBRARY_PATH) -O0 -o my_main $(SOURCES)
Name | Best | Average | Worst | Memory | Stable | Method | Other notes |
---|---|---|---|---|---|---|---|
Insertion sort | 15 ! | 25 ! | 25 ! | 00 ! | Yes | Insertion | Average case is also , where d is the number of inversions |
Binary tree sort | 50 !— | 20 ! | 20 ! | 15 ! | Yes | Insertion | When using a self-balancing binary search tree |
Cycle sort | 50 !— | 25 ! | 25 ! | 00 ! | No | Insertion | In-place with theoretically optimal number of writes |
Selection sort | 25 ! | 25 ! | 25 ! | 00 ! | No | Selection | Its stability depends on the implementation. Used to sort this table in Safari or other Webkit web browser [2]. |
Bubble sort | 15 ! | 25 ! | 25 ! | 00 ! | Yes | Exchanging | Tiny code |
Merge sort | 20 ! | 20 ! | 20 ! | 50 !Depends | Yes | Merging | Used to sort this table in Firefox [3]. |
Quicksort | 20 ! | 20 ! | 25 ! | 05 ! | Depends | Partitioning | Can be implemented as a stable sort depending on how the pivot is handled. Naïve variants use space |
\ | . | possible implementation | insert/remove at the beginning | insert/remove at the end | find |
vector | sequence, key not unique, back-insertion | dynamic array (malloc) | o(n) | o(1) | o(1) (operator[]) o(n) (iter or algo) |
list | sequence, key not unique | doubly-linked list | o(1) | o(1) | o(n) (iter or algo) |
set | sorted associative container, key unique | sorted tree | o(log(n)) | o(log(n)) | o(log(n)) |
map | sorted associative container, key unique | sorted tree | o(log(n)) | o(log(n)) | o(log(n)) |
hash_map | hashed associative container, key unique | hashmap | o(1) | o(1) | o(1) |
\ | . | possible implementation | insert/remove at the beginning | insert/remove at the end | find |
deque | sequence, key not unique o(n) in the middle | dynamic array or doubly-linked list | o(1) | o(1) | o(n) |
slist | sequence, key not unique, single direction iterator, front-insertion | single-linked list | o(1) | o(n) o(1) if insert_after | o(n) |
template < class F > class ClassTemp { public: F test(F* feature ); }; template < class F > F ClassTemp < F > ::test(F* feature) { return *feature; }; ClassTemp < char > myInst; int main() { char c = 'c'; char ret = myInst.test(&c); }
http://swiss-knife.blogspot.fr/search?q=ubuntuto see all posts, or backup blogger blogs:
http://swiss-knife.blogspot.fr/search?max-results=1000&start=0
mvn archetype:generate
-DgroupId=com.yourcompany.engine.api -DartifactId=EngineApi -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
mvn eclipse:clean
JAVA_OPTS="-Djava.awt.headless=true -server -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"