{"id":13507198,"url":"https://github.com/stocks29/dlist","last_synced_at":"2026-03-10T07:01:31.258Z","repository":{"id":28307069,"uuid":"31819784","full_name":"stocks29/dlist","owner":"stocks29","description":"Deque implementations in elixir","archived":false,"fork":false,"pushed_at":"2015-03-09T01:56:22.000Z","size":124,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-13T01:55:54.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stocks29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-07T17:04:40.000Z","updated_at":"2020-04-27T17:01:15.000Z","dependencies_parsed_at":"2022-09-02T20:21:22.441Z","dependency_job_id":null,"html_url":"https://github.com/stocks29/dlist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stocks29/dlist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocks29%2Fdlist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocks29%2Fdlist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocks29%2Fdlist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocks29%2Fdlist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stocks29","download_url":"https://codeload.github.com/stocks29/dlist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocks29%2Fdlist/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30326893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:27.199Z","updated_at":"2026-03-10T07:01:31.230Z","avatar_url":"https://github.com/stocks29.png","language":"Elixir","funding_links":[],"categories":["Algorithms and Data structures"],"sub_categories":[],"readme":"Dlist\n=====\n\nAn elixir library containing two Deque implementations.\n\nAPI documentation is available at http://hexdocs.pm/dlist\n\n# Add as dependency\n\n```elixir\n{:dlist, \"~\u003e 0.0.1\"}\n```\n\n# Libraries\n\n## Dlist.Deque\n\nThis implementation is a two list solution.\n\nThis supports fast inserts done in constant time. The `first` and `last` operations are worst case O(n). `to_list` is also O(n) worst case.\n\n```elixir\nalias Dlist.Deque\n\ndeque = Deque.new\ndeque = Deque.append(deque, 2)\ndeque = Deque.append(deque, 3)\ndeque = Deque.prepend(deque, 1)\ndeque = Deque.prepend(deque, 0)\nIO.puts inspect Deque.to_list(deque)\n# ==\u003e [0, 1, 2, 3]\n```\n\n## Dlist.DoublyLinkedList\n\nThis implementation uses a gen_server and therefore is mutable. This is similar to your standard doubly linked list in imperative languages.\n\nIt supports fast inserts in constant time. `first` and `last` operations are also done in constant time. `to_list`, is always O(n) since it must traverse all nodes to build the list.\n\n**Be sure to destory the list when you're finished using it.**\n\n```elixir\nalias Dlist.DoublyLinkedList, as: DLL\n\n{:ok, dll} = DLL.new\nDLL.append(dll, 2)\nDLL.append(dll, 3)\nDLL.prepend(dll, 1)\nDLL.prepend(dll, 0)\nIO.puts inspect DLL.to_list(dll)\n# ==\u003e [0, 1, 2, 3]\n\nDLL.destroy(dll)\n```\n\n# Benchmarks\n\nThe two list `Deque` implementation is much faster than the gen_server `DoublyLinkedList` for the sample code above. The benchmarking script can be found in `benchmarks.exs`.\n\n```bash\n$ mix run benchmarks.exs\n*** \u0026DlistBenchmark.deque_append_prepend_to_list/0 ***\n1.2 sec     2M iterations   0.6 μs/op\n\n*** \u0026DlistBenchmark.dll_append_prepend_to_list/0 ***\n1.2 sec     8K iterations   157.36 μs/op\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstocks29%2Fdlist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstocks29%2Fdlist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstocks29%2Fdlist/lists"}