Tag: algorithm

Unsigned Count Down



Introduction Something that comes up surprisingly often is traversing an array backwards. Maybe you’re emptying a queue. How about my personal favorite, reversing the order of elements. Counting in a for loop is so common you just don’t think about it. But counting backwards can lead to issues... Continue reading

Looping Through Bytes to Check for Bits



Checking for bits in 1 byte is easy. Checking in 2 bytes is also easy. Checking an odd number of bits in a variable number bytes isn’t so easy. The hard part is dealing with the boundary between bytes where we need to move from one to the next. Lets... Continue reading

Mergesort in C



Introduction Quicksort is most people’s go to sort function and that’s not a bad thing because it’s a really good general purpose sorting algorithm. A good implementation is really fast and, being an in place algorithm, it uses very little memory. The big drawback of Quicksort is that... Continue reading

General Comparison Functions in C



Introduction qsort, heapsort, mergesort, bsearch, and many more search and sort functions all take a compar argument to determine the sorting order of elements in an array. The compar function takes the form int (*compar)(const void *, const void *). The <code... Continue reading

Quicksort in C



Introduction Quicksort is one of the most common sorting algorithms and one of the most efficient. It’s so common that it’s part of C89. That said, it’s still good to know how it works, its strengths, and it’s weaknesses. It takes as a divide and conquer approach to sorting.... Continue reading

Byte Swapping in C



Introduction Some times you need to swap bytes. Sometimes you don’t. But right now we do. Well, we don’t but if we were implementing some sorting functions we’d need a good swap function. Sorting typically doesn’t move pointers around, instead it moves the bytes pointed to by the pointer.... Continue reading

ARC ActiveX Apple B&N Base64 C lang COM DLL Device FLAC FT GUI GeR2 JNI Linux Lua Lua C API Mac N770 OS X Off Road OpenSSL STR Shocks Sigil Suspension TOC TRD TRD Pro TRD Sport Tacoma Toyota Windows about algorithm amazon analysis android apnx app arch linux automotive backup bash batteries book bookeen bookview bug bzr c++ calibre car cats configuration container conversion copyright copyright infringement cover cybook data structure decoding development device interfaces direction distros dmca donations downloader drm dropbox duplicity eReader ebook ebooks editor electronics encoding epub fb2 files focus st formats formatting future gadgets generic type get books git github gnome google gpl guide hardening headless heuristic hex hg htmlz iOS ideas image intel internationalization interop java jekyll json kernel kindle kwin language law lebookread legal library linode maintenance maintenance programming markdown memory mobi mp3 music nginx nook objective-c opds openid opensearch opf packages palmdoc pcre pdb pdf pgm plans play store plucker plugin pml pmlz pocket pro podcast ppa print project management prs prs300 prs505 prs700 prs900 pyqt python qt rb regex release reveiw reverse engineer review rtf s2n scm screen saver screenshot script search security server sort sorting source code specification spell check spideroak ssl store sync t2b t4b tcr textile thanks thread threading thumbnail tips translations truck txt txtz ubuntu usb video widget wordpress wpmu x11 xlib xorg xxd yubikey zip ztxt