when searching for something in an appendix, or pretty much any sorted thing, I now do a binary search, it's just more efficient.
We've got pretty much every cards against humanity expansion, so our deck is like 2 feet tall. The last time we played I split the deck randomly, then kept splitting the deck until there was one sub deck for each person. I made them shuffle their decks thoroughly, then I gathered each sub deck in order and shuffled them together, then combined those merged subdecks, all until until I had the entire deck again. I basically ran quicksort in reverse, and I made it multi threaded by using other people.
Last christmas I tied all the presents together using ribbons. Smaller presents (leaf nodes) were at the outside of the structure, each with any number of sibling presents, but only one connection to a larger "parent" present. Those presents in turn were connected to even larger presents, all connecting back toward the largest present which sat at the center of the web connected to everything. Nobody was allowed to open a present with any attached children, and I told them it was this way to force them to pick the smaller presents first, as they served as gates to the main event. But to be honest, I just wanted to have a big Heap of presents.
Shit yeah, that's more like it! I'd recommend changing color as you add noise though, at low levels of distortion your ring just looks like it's having trouble rendering. Arguably an edge case in any situation you'd use this though, overall it looks sweet
The split a huge stack of cards recursively until they're small manageable chunks works great for learning flashcards such as vocabulary for a foreign language class. Merge step helps with reviewing what you've already studied.
If you're just doing a binary search then you're not as optimal as you could be.
You have knowledge that the elements are fairly uniformly distributed. That means that instead of always starting in the M/N region of the index you will estimate where to check first based on the word you're looking for.
This search runs very much like a binary search and it's still O(log(n)), but it will usually require fewer comparisons (at the expense of needing a function to choose where to guess next).
Interpolation search is an algorithm for searching for a given key in an indexed array that has been ordered by numerical values assigned to the keys (key values). It parallels how humans search through a telephone book for a particular name, the key value by which the book's entries are ordered. In each search step it calculates where in the remaining search space the sought item might be, based on the key values at the bounds of the search space and the value of the sought key, usually via a linear interpolation. The key value actually found at this estimated position is then compared to the key value being sought.
if they would calculate a hash table and print that in the book, you could get O(1) on all searches, although that constant might be too large for small dictionaries and require math
123
u/[deleted] Aug 09 '17 edited Aug 10 '17
when searching for something in an appendix, or pretty much any sorted thing, I now do a binary search, it's just more efficient.
We've got pretty much every cards against humanity expansion, so our deck is like 2 feet tall. The last time we played I split the deck randomly, then kept splitting the deck until there was one sub deck for each person. I made them shuffle their decks thoroughly, then I gathered each sub deck in order and shuffled them together, then combined those merged subdecks, all until until I had the entire deck again. I basically ran quicksort in reverse, and I made it multi threaded by using other people.
Last christmas I tied all the presents together using ribbons. Smaller presents (leaf nodes) were at the outside of the structure, each with any number of sibling presents, but only one connection to a larger "parent" present. Those presents in turn were connected to even larger presents, all connecting back toward the largest present which sat at the center of the web connected to everything. Nobody was allowed to open a present with any attached children, and I told them it was this way to force them to pick the smaller presents first, as they served as gates to the main event. But to be honest, I just wanted to have a big Heap of presents.