From b6000dc163000e6a3abd54596cf173b06f57bdb2 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 22 Aug 2016 08:46:19 -0400 Subject: [PATCH] added kdq --- index.html | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 4bd920f..d470228 100644 --- a/index.html +++ b/index.html @@ -187,6 +187,8 @@ Error message and password prompt
  • KBtree: generic ordered map
  • +
  • Kdq: double-ended queue
  • +
  • Kexpr: parsing mathematical expressions
  • Khash: generic hash table
  • @@ -8239,7 +8241,7 @@ pre .xml .cdata {
    $:/core/ui/ControlPanel/Appearance
    -
    +
    TableOfContents
    @@ -8380,7 +8382,7 @@ pre .xml .cdata {
    classic
    -
    +
    [[Klib|https://github.com/attractivechaos/klib/]] is a standalone and lightweight C library distributed under [[MIT/X11 license|http://en.wikipedia.org/wiki/MIT_License]]. Most components are independent of external libraries, except the standard C library, and independent of each other. To use a component of this library, you only need to copy a couple of files to your source code tree without worrying about library dependencies.
     
     Klib strives for efficiency and a small memory footprint. Some components, such as hash table, B-tree, vector and sorting algorithms, are among the most efficient implementations of similar algorithms or data structures in all programming languages, in terms of both speed and memory use.
    @@ -8392,6 +8394,7 @@ Klib strives for efficiency and a small memory footprint. Some components, such
     * [[ksort.h|Ksort: sorting, shuffling, heap and k-small]]: generic sort, including introsort, merge sort, heap sort, comb sort, Knuth shuffle and the k-small algorithm.
     * [[kseq.h|Kseq: stream buffer and FASTA/Q parser]]: generic stream buffer and a FASTA/FASTQ format parser.
     * kvec.h: generic dynamic array.
    +* [[kdq.h|Kdq: double-ended queue]]: generic double-ended queue (de-queue).
     * klist.h: generic single-linked list and memory pool.
     * kstring.{h,c}: basic string library.
     * kmath.{h,c}: numerical routines including [[MT19937-64|http://en.wikipedia.org/wiki/Mersenne_twister]] pseudorandom number generator, basic nonlinear programming and a few special math functions.
    @@ -8604,6 +8607,34 @@ int main(int argc, char *argv[])
     }
     ```
    +
    +
    !!Synopsis
    +* Functionality: double-ended queue (de-queue) implemented with a rolling buffer
    +* Library source code: [[kdq.h|https://github.com/attractivechaos/klib/blob/master/kdq.h]]
    +* Dependencies: none
    +!!Example
    +
    +```c
    +#include <stdio.h>
    +#include "kdq.h"
    +KDQ_INIT(int)
    +
    +int main(void)
    +{
    +	int i, t;
    +	kdq_t(int) *q;
    +	q = kdq_init(int);
    +	kdq_push(int, q, 7);     // add an element from the tail
    +	kdq_unshift(int, q, 5);  // ddd an element from the head
    +	kdq_unshift(int, q, 3);  // ddd an element from the head
    +	t = kdq_shift(int, q);   // get an element from the head
    +	for (i = 0; i < kdq_size(q); ++i) // iterate from head to tail
    +		printf("q[%d]=%d\n", i, kdq_at(q, i));
    +	kdq_destroy(int, q);
    +	return 0;
    +}
    +```
    +
    !!Synopsis
     * Functionality: parse a mathematical expression with the [[Shunting-yard algorithm|https://en.wikipedia.org/wiki/Shunting-yard_algorithm]] and evaluate the final value. The library supports functions and variables.
    @@ -9074,10 +9105,10 @@ int main(int argc, char *argv[])
     }
     ```
    -
    +
    <<list-links "[tag[Library Documentations]]">>
    -
    +
    <div class="tc-table-of-contents">
     <<toc "TableOfContents" sort[title]>>
     </div>
    -- 2.47.3