diff --git a/tech/algorithms.wiki b/tech/algorithms.wiki index 64687c6..51291e5 100644 --- a/tech/algorithms.wiki +++ b/tech/algorithms.wiki @@ -9,12 +9,26 @@ Different ways to store and operate on data, with differing efficiency * [[linked_list|Linked List]] * [[stack|Stack]] * [[queue|Queue]] +* [[skip_list|Skip list]] +* [[hash_table|Hash Table]] == Non sequential Data Structures == * [[binary_tree|Binary Tree]] * [[graph|Graph]] +* [[b_tree|B-Tree]] +* [[red_black_tree|Red Black Tree]] +* [[splay_tree|Splay Tree]] +* [[avl_tree|AVL Tree]] +* [[kd_tree|KD Tree]] +== Sorting == +* [[quicksort|Quicksort]] +* [[mergesort|Mergesort]] +* [[heapsort|Heapsort]] +* [[radix|Radix]] +* [[bucket|Bucket]] +* [[counting|Counting]] [[../index]] diff --git a/tech/array.wiki b/tech/array.wiki new file mode 100644 index 0000000..76fd34c --- /dev/null +++ b/tech/array.wiki @@ -0,0 +1,16 @@ += Array = + +A sequential data structure of consecutive items. Fixed length (usually). + +== Good for == + +* Fixed size sets of data +* Acessing an index in O(1) +* Data that doesnt change often + +== Bad for == + +* Data that will change sizes often +* Data when you need to search by contents, not index + +[[algorithms]] diff --git a/tech/linked_list.wiki b/tech/linked_list.wiki new file mode 100644 index 0000000..061c1ad --- /dev/null +++ b/tech/linked_list.wiki @@ -0,0 +1,36 @@ += Linked lists = + +A Sequential "list" of elements that is basically a daisy chain of pointers. +Comes in single and double linked flavors. This thing really has one good +property but that can be abused by linking it with other data structures (think +LRUCache) + +== Good for == + +* Data that is often swaped or deleted, done in O(1) + +== Bad for == + +* Basically everything else + + +== Optimize == + +If memory is a real concern you can XOR the pointers to the next and prev items. +To do this you need to xor the prev and next addresses, then when traversing +xor the previous and the combined pointer. This really is only when youre +worrying about like 4 bytes per node and either have tons of nodes or memory is +precious and the time spent XORing is a valid tradeoff. + +== Visual == +{{{ +Head Tail +---------------- --------- --------- --------- ---------------- +| Data | | Data | | Data | | Data | | Data | +| prev* (NULL) | <= | prev* | <= | prev* | <= | prev* | <= | prev* | +| next* | => | next* | => | next* | => | next* | => | next* (NULL) | +---------------- --------- --------- --------- ---------------- +}}} + + +[[algorithms]] diff --git a/tech/queue.wiki b/tech/queue.wiki new file mode 100644 index 0000000..ac05175 --- /dev/null +++ b/tech/queue.wiki @@ -0,0 +1,16 @@ += Queue = + +A literal ordered queue. Keep an order of elements and only push on and remove +from the back + +== Good For == + +* Keeping an order of elements + + +== Bad For == + +* Everything else + + +[[algorithms]] diff --git a/tech/splay_tree.wiki b/tech/splay_tree.wiki new file mode 100644 index 0000000..e69de29 diff --git a/tech/stack.wiki b/tech/stack.wiki new file mode 100644 index 0000000..b8082e2 --- /dev/null +++ b/tech/stack.wiki @@ -0,0 +1,16 @@ += Stack = + +First in Last Out container. Think like a stack of plates, you take off the top +first. Really speciallized and great for things like pre/postfix parsing and +like + +== Good For == + +* Keeping an order of things added + + +== Bad For == + +* Everything else + +[[algorithms]] diff --git a/tech/vector.wiki b/tech/vector.wiki new file mode 100644 index 0000000..e0a5af2 --- /dev/null +++ b/tech/vector.wiki @@ -0,0 +1,16 @@ += Vector = + +Like an array, but takes care of resizing + +== Good for == + +* Fixed size sets of data +* Acessing an index in O(1) +* Data that doesnt change often + +== Bad for == + +* Data that will change sizes often +* Data when you need to search by contents, not index + +[[algorithms]]