All Projects → edwingeng → deque

edwingeng / deque

Licence: BSD-3-Clause license
A highly optimized double-ended queue

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to deque

Containers
This library provides various containers. Each container has utility functions to manipulate the data it holds. This is an abstraction as to not have to manually manage and reallocate memory.
Stars: ✭ 125 (+66.67%)
Mutual labels:  queue, vector, array
deque
JavaScript implementation of a double-ended queue
Stars: ✭ 17 (-77.33%)
Mutual labels:  queue, deque, dequeue
quetie
🎀 Just the cutest and tiniest queue/deque implementation!
Stars: ✭ 111 (+48%)
Mutual labels:  queue, deque, double-ended-queue
30 Seconds Of Cpp
30 Seconds of C++ (STL in C++). Read More about 30C++ here 👉
Stars: ✭ 815 (+986.67%)
Mutual labels:  queue, vector
Collection
A PHP library for representing and manipulating collections.
Stars: ✭ 488 (+550.67%)
Mutual labels:  queue, array
Android interviews
🚀Everything you need to know to find a android job. 算法 / 面试题 / Android 知识点 🔥🔥🔥 总结不易,你的 star 是我最大的动力!
Stars: ✭ 510 (+580%)
Mutual labels:  queue, array
Cracking The Coding Interview
Solutions for Cracking the Coding Interview - 6th Edition
Stars: ✭ 35 (-53.33%)
Mutual labels:  queue, array
Libgenerics
libgenerics is a minimalistic and generic library for C basic data structures.
Stars: ✭ 42 (-44%)
Mutual labels:  queue, vector
Geeksforgeeks Dsa 2
This repository contains all the assignments and practice questions solved during the Data Structures and Algorithms course in C++ taught by the Geeks For Geeks team.
Stars: ✭ 53 (-29.33%)
Mutual labels:  queue, array
Algo Tree
Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. It contains solutions in various languages such as C++, Python and Java.
Stars: ✭ 166 (+121.33%)
Mutual labels:  queue, array
Sc
Common libraries and data structures for C.
Stars: ✭ 161 (+114.67%)
Mutual labels:  queue, vector
data-structure-project
自己实现集合框架系列整理总结
Stars: ✭ 29 (-61.33%)
Mutual labels:  queue, array
Algodeck
An Open-Source Collection of 200+ Algorithmic Flash Cards to Help you Preparing your Algorithm & Data Structure Interview 💯
Stars: ✭ 4,441 (+5821.33%)
Mutual labels:  queue, array
Qlibc
qLibc is a simple and yet powerful C library providing generic data structures and algorithms
Stars: ✭ 614 (+718.67%)
Mutual labels:  queue, vector
Mlib
Library of generic and type safe containers in pure C language (C99 or C11) for a wide collection of container (comparable to the C++ STL).
Stars: ✭ 321 (+328%)
Mutual labels:  queue, array
Javascript Datastructures Algorithms
📚 collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Stars: ✭ 3,221 (+4194.67%)
Mutual labels:  queue, deque
ctl
My variant of the C Template Library
Stars: ✭ 105 (+40%)
Mutual labels:  queue, deque
Data-Structures-and-Algorithms
Data Structures and Algorithms implementation in Python
Stars: ✭ 31 (-58.67%)
Mutual labels:  queue, array
Gostl
Data structure and algorithm library for go, designed to provide functions similar to C++ STL
Stars: ✭ 254 (+238.67%)
Mutual labels:  queue, vector
Data Structures
Common data structures and algorithms implemented in JavaScript
Stars: ✭ 139 (+85.33%)
Mutual labels:  queue, array

Please use the generic version, if you have golang 1.18 or above.

Overview

Deque is a highly optimized double-ended queue, which is much efficient compared with list.List when adding or removing elements from the beginning or the end.

Benchmark

PushBack/Deque<harden>       100000000       12.0 ns/op       8 B/op      0 allocs/op
PushBack/Deque                20000000       55.5 ns/op      24 B/op      1 allocs/op
PushBack/list.List             5000000      158.7 ns/op      56 B/op      1 allocs/op

PushFront/Deque<harden>      195840157        9.2 ns/op       8 B/op      0 allocs/op
PushFront/Deque               30000000       49.2 ns/op      24 B/op      1 allocs/op
PushFront/list.List            5000000      159.2 ns/op      56 B/op      1 allocs/op

Random/Deque<harden>          65623633       15.1 ns/op       0 B/op      0 allocs/op
Random/Deque                  50000000       24.7 ns/op       4 B/op      0 allocs/op
Random/list.List              30000000       46.9 ns/op      28 B/op      1 allocs/op

Getting Started

go get -u github.com/edwingeng/deque

Usage

dq := deque.NewDeque()
dq.PushBack(100)
dq.PushBack(200)
dq.PushBack(300)
for !dq.Empty() {
    fmt.Println(dq.PopFront())
}

dq.PushFront(100)
dq.PushFront(200)
dq.PushFront(300)
for i, n := 0, dq.Len(); i < n; i++ {
    fmt.Println(dq.PopFront())
}

// Output:
// 100
// 200
// 300
// 300
// 200
// 100

Harden the element data type

./harden.sh <outputDir> <packageName> [elemType]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].