[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"navigation":3,"url-settings":86,"blog-\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists":671,"blog-author-\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists":1373,"i-material-symbols:arrow-back-rounded":1385},{"id":4,"extension":5,"footer":6,"header":73,"meta":83,"stem":84,"__hash__":85},"navigation\u002Fdata\u002Fshared\u002Fnavigation.yml","yml",{"brand":7,"columns":13,"legal":63},{"name":8,"tagline":9,"downloadCta":10},"Pieces","The memory layer for modern work.",{"label":11,"href":12},"All downloads","\u002Fdownloads",[14,26,39,51],{"title":15,"links":16},"Product",[17,20,23],{"label":18,"href":19},"Pieces Desktop","\u002F",{"label":21,"href":22},"Pieces Enterprise","\u002Fenterprise",{"label":24,"href":25},"Pieces MCP","\u002Fmcp",{"title":27,"links":28},"Resources",[29,33,36],{"label":30,"href":31,"external":32},"Documentation","url:docs.home",true,{"label":34,"href":35},"Blog","\u002Fblog",{"label":37,"href":38,"external":32},"GitHub","url:github.org",{"title":40,"links":41},"Community",[42,45,48],{"label":43,"href":44,"external":32},"Discord","url:social.discord",{"label":46,"href":47,"external":32},"X \u002F Twitter","url:social.x",{"label":49,"href":50,"external":32},"LinkedIn","url:social.linkedin",{"title":52,"links":53},"Company",[54,57,60],{"label":55,"href":56},"About","\u002Fabout",{"label":58,"href":59},"Updates","\u002Fupdates",{"label":61,"href":62},"Contact","\u002Fcontact",[64,67,70],{"label":65,"href":66},"Privacy Policy","\u002Flegal\u002Fprivacy",{"label":68,"href":69},"Refund Policy","\u002Flegal\u002Frefund",{"label":71,"href":72},"Terms of Service","\u002Flegal\u002Fterms",{"links":74,"signIn":75,"contact":78,"cta":80},[],{"label":76,"href":77},"Manage account","url:portal.home",{"label":79,"href":62},"Get in touch",{"label":81,"href":82},"Download","url:routes.downloads",{},"data\u002Fshared\u002Fnavigation","XlSALC7vYCXHcmcXnjJViwIZKsqnQWF4bn4o9RrcSBE",{"id":87,"extension":5,"links":88,"meta":668,"stem":669,"__hash__":670},"urlSettings\u002Fdata\u002Fshared\u002Furls.yml",[89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,169,173,177,181,185,189,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276,280,284,288,292,296,300,303,307,311,314,318,322,326,330,334,338,342,346,350,354,358,362,366,370,374,378,382,386,390,394,398,402,406,410,414,418,422,426,430,434,438,442,446,450,454,458,461,465,469,473,477,481,485,488,491,494,497,501,505,508,512,516,520,524,528,532,536,540,544,548,552,556,559,563,567,571,575,579,582,585,588,592,595,599,603,607,611,614,618,622,625,628,631,635,639,643,646,649,652,656,660,664],{"key":90,"label":91,"href":92},"downloads.desktop","Desktop download page","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fdownload",{"key":94,"label":95,"href":96},"downloads.macOS.dmgArm64","macOS DMG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fdmg-arm64\u002Fdownload",{"key":98,"label":99,"href":100},"downloads.macOS.dmgIntel","macOS DMG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fdmg\u002Fdownload",{"key":102,"label":103,"href":104},"downloads.macOS.pkg","macOS PKG","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg\u002Fdownload",{"key":106,"label":107,"href":108},"downloads.macOS.universal","Desktop macOS Universal","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fmacos-universal\u002Fdownload",{"key":110,"label":111,"href":112},"downloads.macOS.pkgArm64","Desktop macOS PKG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pfd-arm64\u002Fdownload",{"key":114,"label":115,"href":116},"downloads.macOS.pkgIntel","Desktop macOS PKG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pfd\u002Fdownload",{"key":118,"label":119,"href":120},"downloads.windows.appinstaller","Windows App Installer","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fappinstaller\u002Fpieces_for_x.appinstaller",{"key":122,"label":123,"href":124},"downloads.windows.exe","Windows EXE","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fwindows-exe\u002Fdownload",{"key":126,"label":127,"href":128},"downloads.windows.msix","Windows MSIX","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fwindows-msix\u002Fdownload",{"key":130,"label":131,"href":132},"downloads.windows.suiteManager","Windows Suite Manager","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_suite_windows\u002Fappinstaller\u002Fdownload",{"key":134,"label":135,"href":136},"downloads.linux.flatpakRepo","Linux Flatpak repository","https:\u002F\u002Fbuilds.pieces.app\u002Fpieces-flatpak-repo\u002Fpieces-flatpak.flatpakrepo",{"key":138,"label":139,"href":140},"downloads.linux.snapDesktop","Linux Snap Desktop","https:\u002F\u002Fsnapcraft.io\u002Fpieces-for-developers",{"key":142,"label":143,"href":144},"downloads.linux.snapPiecesOS","Linux Snap PiecesOS","https:\u002F\u002Fsnapcraft.io\u002Fpieces-os",{"key":146,"label":147,"href":148},"downloads.linux.snap","Desktop Linux Snap package","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fsnap\u002Fdownload",{"key":150,"label":151,"href":152},"downloads.piecesOS.macOS.dmgArm64","PiecesOS macOS DMG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fdmg-arm64\u002Fdownload",{"key":154,"label":155,"href":156},"downloads.piecesOS.macOS.dmgIntel","PiecesOS macOS DMG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fdmg\u002Fdownload",{"key":158,"label":159,"href":160},"downloads.piecesOS.macOS.universal","PiecesOS macOS Universal","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fmacos-universal\u002Fdownload",{"key":162,"label":163,"href":164},"downloads.piecesOS.macOS.pkgArm64","PiecesOS macOS PKG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pos-launch-only-arm64\u002Fdownload",{"key":166,"label":167,"href":168},"downloads.piecesOS.macOS.pkgIntel","PiecesOS macOS PKG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pos-launch-only\u002Fdownload",{"key":170,"label":171,"href":172},"downloads.piecesOS.windows.appinstaller","PiecesOS Windows App Installer","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fappinstaller\u002Fos_server.appinstaller",{"key":174,"label":175,"href":176},"downloads.piecesOS.windows.exe","PiecesOS Windows EXE","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fwindows-exe\u002Fdownload",{"key":178,"label":179,"href":180},"downloads.piecesOS.windows.msix","PiecesOS Windows MSIX","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fwindows-msix\u002Fdownload",{"key":182,"label":183,"href":184},"downloads.piecesOS.linux.snap","PiecesOS Linux Snap package","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fsnap\u002Fdownload",{"key":186,"label":187,"href":188},"downloads.combined.macOS.appleSilicon","Combined macOS installer Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-arm64\u002Fdownload",{"key":190,"label":191,"href":104},"downloads.combined.macOS.intel","Combined macOS installer Intel",{"key":193,"label":194,"href":195},"downloads.guides.macOS","macOS installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Fmacos-installation-guide",{"key":197,"label":198,"href":199},"downloads.guides.windows","Windows installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Fwindows-installation-guide",{"key":201,"label":202,"href":203},"downloads.guides.linux","Linux installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Flinux-installation-guide",{"key":205,"label":206,"href":207},"downloads.guides.linuxFlatpak","Linux Flatpak installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Flinux-installation-guide\u002Fflatpak",{"key":209,"label":210,"href":211},"downloads.guides.linuxSnap","Linux Snap installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Flinux-installation-guide\u002Fsnap",{"key":213,"label":214,"href":215},"downloads.guides.piecesOS","PiecesOS manual installation","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os\u002Fmanual-installation",{"key":217,"label":218,"href":219},"extensions.chrome","Chrome extension","https:\u002F\u002Fchrome.google.com\u002Fwebstore\u002Fdetail\u002Fpieces-save-code-snippets\u002Figbgibhbfonhmjlechmeefimncpekepm",{"key":221,"label":222,"href":223},"extensions.firefox","Firefox add-on","https:\u002F\u002Faddons.mozilla.org\u002Fen-US\u002Ffirefox\u002Faddon\u002Fpieces-save-code-from-the-web\u002F",{"key":225,"label":226,"href":227},"extensions.edge","Edge add-on","https:\u002F\u002Fmicrosoftedge.microsoft.com\u002Faddons\u002Fdetail\u002Fpieces-save-code-snippet\u002Fhglfimcdgonaeeobjckfdabcldfidmim",{"key":229,"label":230,"href":231},"extensions.vscode","VS Code extension","https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=MeshIntelligentTechnologiesInc.pieces-vscode",{"key":233,"label":234,"href":235},"extensions.visualStudio","Visual Studio extension","https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=MeshIntelligentTechnologiesInc.PiecesVisualStudio",{"key":237,"label":238,"href":239},"extensions.jetbrains","JetBrains plugin","https:\u002F\u002Fplugins.jetbrains.com\u002Fplugin\u002F17328-pieces--save-search-share--reuse-code-snippets",{"key":241,"label":242,"href":243},"extensions.obsidian","Obsidian plugin","https:\u002F\u002Fobsidian.md\u002Fplugins?id=pieces-for-developers",{"key":245,"label":246,"href":247},"extensions.sublime","Sublime package","https:\u002F\u002Fpackagecontrol.io\u002Fpackages\u002FPieces",{"key":249,"label":250,"href":251},"extensions.neovim","Neovim plugin","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fplugin_neo_vim",{"key":253,"label":254,"href":255},"extensions.jupyterlab","JupyterLab plugin","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fjupyterlab-pieces",{"key":257,"label":258,"href":259},"extensions.cli","Pieces CLI","https:\u002F\u002Fpypi.org\u002Fproject\u002Fpieces-cli\u002F",{"key":261,"label":262,"href":263},"docs.home","Documentation home","https:\u002F\u002Fdocs.pieces.app",{"key":265,"label":266,"href":267},"docs.getStarted","Get started docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces",{"key":269,"label":270,"href":271},"docs.api","API docs","https:\u002F\u002Fdocs.pieces.app\u002Fapi",{"key":273,"label":274,"href":275},"docs.desktop.overview","Desktop overview","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop",{"key":277,"label":278,"href":279},"docs.desktop.onboarding","Desktop onboarding","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fonboarding",{"key":281,"label":282,"href":283},"docs.desktop.timeline","Desktop timeline docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Ftimeline",{"key":285,"label":286,"href":287},"docs.desktop.summaries","Desktop summaries docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fsingle-click-summaries",{"key":289,"label":290,"href":291},"docs.desktop.search","Desktop conversational search docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fconversational-search",{"key":293,"label":294,"href":295},"docs.desktop.drive","Desktop drive docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fdrive",{"key":297,"label":298,"href":299},"docs.desktop.account","Desktop account settings docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fconfiguration\u002Faccount",{"key":301,"label":302,"href":92},"docs.desktop.download","Desktop download docs",{"key":304,"label":305,"href":306},"docs.piecesOS.overview","PiecesOS overview docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies",{"key":308,"label":309,"href":310},"docs.piecesOS.details","PiecesOS details docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os",{"key":312,"label":313,"href":215},"docs.piecesOS.install","PiecesOS install docs",{"key":315,"label":316,"href":317},"docs.piecesOS.quickMenu","PiecesOS quick menu docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os\u002Fquick-menu",{"key":319,"label":320,"href":321},"docs.piecesOS.storage","On-device storage docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fon-device-storage",{"key":323,"label":324,"href":325},"docs.piecesOS.troubleshooting","PiecesOS troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os\u002Ftroubleshooting",{"key":327,"label":328,"href":329},"docs.mcp.overview","MCP overview docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp",{"key":331,"label":332,"href":333},"docs.mcp.cursor","MCP Cursor docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fcursor",{"key":335,"label":336,"href":337},"docs.mcp.vscode","MCP VS Code docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fvs-code",{"key":339,"label":340,"href":341},"docs.mcp.claudeDesktop","MCP Claude Desktop docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fclaude-desktop",{"key":343,"label":344,"href":345},"docs.mcp.claudeCode","MCP Claude Code docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fclaude-code",{"key":347,"label":348,"href":349},"docs.mcp.claudeCowork","MCP Claude Cowork docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fclaude-cowork",{"key":351,"label":352,"href":353},"docs.mcp.githubCopilot","MCP GitHub Copilot docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fgithub-copilot",{"key":355,"label":356,"href":357},"docs.mcp.goose","MCP Goose docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fgoose",{"key":359,"label":360,"href":361},"docs.mcp.windsurf","MCP Windsurf docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fwindsurf",{"key":363,"label":364,"href":365},"docs.mcp.zed","MCP Zed docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fzed",{"key":367,"label":368,"href":369},"docs.mcp.jetbrains","MCP JetBrains docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fjetbrains-ides",{"key":371,"label":372,"href":373},"docs.mcp.continueDev","MCP Continue docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fcontinue-dev",{"key":375,"label":376,"href":377},"docs.mcp.cline","MCP Cline docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fcline",{"key":379,"label":380,"href":381},"docs.mcp.raycast","MCP Raycast docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fraycast",{"key":383,"label":384,"href":385},"docs.mcp.rovoDevCli","MCP Rovo Dev CLI docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Frovo-dev-cli",{"key":387,"label":388,"href":389},"docs.mcp.openaiCodexCli","MCP OpenAI Codex CLI docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fopenai-codex-cli",{"key":391,"label":392,"href":393},"docs.mcp.googleGeminiCli","MCP Google Gemini CLI docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fgoogle-gemini-cli",{"key":395,"label":396,"href":397},"docs.mcp.amazonQ","MCP Amazon Q docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Famazon-q-developer",{"key":399,"label":400,"href":401},"docs.mcp.chatgptDev","MCP ChatGPT Developer Mode docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fchatgpt-developer-mode",{"key":403,"label":404,"href":405},"docs.mcp.openclaw","MCP OpenClaw docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fopenclaw",{"key":407,"label":408,"href":409},"docs.mcp.mcpRemote","MCP Remote docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fmcp-remote",{"key":411,"label":412,"href":413},"docs.mcp.ngrok","MCP ngrok docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fngrok-setup",{"key":415,"label":416,"href":417},"docs.troubleshooting.macOS","macOS troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Ftroubleshooting\u002Fmacos",{"key":419,"label":420,"href":421},"docs.troubleshooting.windows","Windows troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Ftroubleshooting\u002Fwindows",{"key":423,"label":424,"href":425},"docs.troubleshooting.linux","Linux troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Ftroubleshooting\u002Flinux",{"key":427,"label":428,"href":429},"docs.privacy","Privacy and security docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fprivacy-security-your-data",{"key":431,"label":432,"href":433},"docs.support","Support docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fsupport",{"key":435,"label":436,"href":437},"portal.home","Pieces portal","https:\u002F\u002Fportal.pieces.app",{"key":439,"label":440,"href":441},"site.home","Website home","https:\u002F\u002Fpieces.app",{"key":443,"label":444,"href":445},"site.about","About page","https:\u002F\u002Fpieces.app\u002Fabout",{"key":447,"label":448,"href":449},"site.features","Features page","https:\u002F\u002Fpieces.app\u002Ffeatures",{"key":451,"label":452,"href":453},"site.plugins","Plugins page","https:\u002F\u002Fpieces.app\u002Fplugins",{"key":455,"label":456,"href":457},"site.contact","Contact page","https:\u002F\u002Fpieces.app\u002Fcontact",{"key":459,"label":58,"href":460},"site.updates","https:\u002F\u002Fpieces.app\u002Fupdates",{"key":462,"label":463,"href":464},"site.news","News","https:\u002F\u002Fpieces.app\u002Fnews",{"key":466,"label":467,"href":468},"site.events","Community events","https:\u002F\u002Fpieces.app\u002Fcommunity\u002Fevents",{"key":470,"label":471,"href":472},"site.userStories","User stories","https:\u002F\u002Fpieces.app\u002Fuser-stories",{"key":474,"label":475,"href":476},"site.academy","Academy","https:\u002F\u002Fpieces.app\u002Flearn\u002Facademy",{"key":478,"label":479,"href":480},"site.support","Website support","https:\u002F\u002Fpieces.app\u002Fsupport",{"key":482,"label":483,"href":484},"site.standup","Standup","https:\u002F\u002Fpieces.app\u002Fstandup",{"key":486,"label":34,"href":487},"site.blog","https:\u002F\u002Fcode.pieces.app\u002Fblog",{"key":489,"label":43,"href":490},"social.discord","https:\u002F\u002Fdiscord.gg\u002Fgetpieces",{"key":492,"label":46,"href":493},"social.x","https:\u002F\u002Fx.com\u002Fgetpieces",{"key":495,"label":496,"href":493},"social.twitter","Twitter",{"key":498,"label":499,"href":500},"social.instagram","Instagram","https:\u002F\u002Fwww.instagram.com\u002Fgetpieces\u002F",{"key":502,"label":503,"href":504},"social.tiktok","TikTok","https:\u002F\u002Fwww.tiktok.com\u002F@getpieces",{"key":506,"label":49,"href":507},"social.linkedin","https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fgetpieces\u002F",{"key":509,"label":510,"href":511},"social.youtube","YouTube","https:\u002F\u002Fyoutube.com\u002F@getpieces",{"key":513,"label":514,"href":515},"github.org","GitHub organization","https:\u002F\u002Fgithub.com\u002Fpieces-app",{"key":517,"label":518,"href":519},"github.support","GitHub support","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fsupport",{"key":521,"label":522,"href":523},"github.issues","GitHub issues","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fsupport\u002Fissues",{"key":525,"label":526,"href":527},"github.discussions","GitHub discussions","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fsupport\u002Fdiscussions",{"key":529,"label":530,"href":531},"github.documentation","GitHub documentation","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fdocumentation",{"key":533,"label":534,"href":535},"github.opensource","GitHub open source","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fopensource",{"key":537,"label":538,"href":539},"github.sdks.python","Python SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-python",{"key":541,"label":542,"href":543},"github.sdks.typescript","TypeScript SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-typescript",{"key":545,"label":546,"href":547},"github.sdks.dart","Dart SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-dart",{"key":549,"label":550,"href":551},"github.sdks.kotlin","Kotlin SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-kotlin",{"key":553,"label":554,"href":555},"github.plugins.obsidian","Obsidian plugin repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fobsidian-pieces",{"key":557,"label":558,"href":255},"github.plugins.jupyterlab","JupyterLab plugin repository",{"key":560,"label":561,"href":562},"github.plugins.sublime","Sublime plugin repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fplugin_sublime",{"key":564,"label":565,"href":566},"github.plugins.neovim","Neovim plugin repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fplugin_neovim",{"key":568,"label":569,"href":570},"github.cliAgent","CLI agent repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fcli-agent",{"key":572,"label":573,"href":574},"github.mcpDart","MCP Dart repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fmcp_dart",{"key":576,"label":577,"href":578},"github.awesomePieces","Awesome Pieces repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fawesome-pieces",{"key":580,"label":581,"href":66},"legal.privacyPolicy","Privacy policy",{"key":583,"label":584,"href":69},"legal.refundPolicy","Refund policy",{"key":586,"label":587,"href":72},"legal.terms","Terms",{"key":589,"label":590,"href":591},"legal.security","Legal security","https:\u002F\u002Fpieces.app\u002Flegal\u002Fsecurity",{"key":593,"label":594,"href":511},"videos.youtubeChannel","YouTube channel",{"key":596,"label":597,"href":598},"videos.gettingStartedDesktop","Getting started desktop video","https:\u002F\u002Fyoutu.be\u002FdUr1lRM_TYk",{"key":600,"label":601,"href":602},"videos.snippetDiscoveryxR","Snippet discovery video","https:\u002F\u002Fyoutu.be\u002FG6vb1USw-30",{"key":604,"label":605,"href":606},"sales.bookACall","Book a sales call","https:\u002F\u002Fcalendar.app.google\u002FWVUDtUfNy5Vst3sH7",{"key":608,"label":609,"href":610},"sales.enterprise","Enterprise form","https:\u002F\u002Fgetpieces.typeform.com\u002Fto\u002FaVQFTvpE",{"key":612,"label":613,"href":527},"sales.feedback","Feedback discussions",{"key":615,"label":616,"href":617},"sales.earlyAccess","Early access form","https:\u002F\u002Fgetpieces.typeform.com\u002Fearlyaccess",{"key":619,"label":620,"href":621},"sales.supportEmail","Support email","mailto:support@pieces.app",{"key":623,"label":624,"href":19},"routes.home","Home route",{"key":626,"label":627,"href":56},"routes.about","About route",{"key":629,"label":630,"href":12},"routes.downloads","Downloads route",{"key":632,"label":633,"href":634},"routes.thanks","Post-install thanks route","\u002Finstall\u002Fthanks",{"key":636,"label":637,"href":638},"routes.pricing","Pricing route","\u002Fpricing",{"key":640,"label":641,"href":642},"cta.freeTrial","Start free trial CTA (Pieces Pro) — used by \u002Fcampaigns\u002F* landing pages","https:\u002F\u002Fcampaigns.pieces.app\u002F",{"key":644,"label":645,"href":22},"routes.enterprise","Enterprise route",{"key":647,"label":648,"href":62},"routes.contact","Contact route",{"key":650,"label":651,"href":59},"routes.updates","Updates route",{"key":653,"label":654,"href":655},"routes.migrationError","Migration error route","\u002Fmigration\u002Ferror",{"key":657,"label":658,"href":659},"routes.authenticated","Post-login authenticated route","\u002Fauth\u002Fsigned-in",{"key":661,"label":662,"href":663},"routes.signed-out","Signed out route","\u002Fauth\u002Fsigned-out",{"key":665,"label":666,"href":667},"routes.authentication-error","Authentication error route","\u002Fauth\u002Ferror",{},"data\u002Fshared\u002Furls","2AvfSWI6bZACH5Kr1ZS3txMLjteRjCjbDR_ul1uRZ9Q",{"id":672,"title":673,"author":674,"authorPhoto":675,"authorPhotoAlt":676,"authorSlug":677,"body":678,"buttonText":676,"buttonUrl":676,"category":1359,"date":1360,"description":1361,"draft":1362,"editorsPick":1362,"extension":1363,"featured":1362,"image":1364,"imageAlt":1365,"meta":1366,"navigation":32,"ogImage":676,"ogImageAlt":676,"path":1367,"seo":1368,"stem":1369,"tags":1370,"__hash__":1372},"blog\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists.md","Everything you Need to Know about Doubly Linked Lists","King AJ","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Frole-based-access-systems-in-nodejs\u002Fauthor.jpeg",null,"king-aj",{"type":679,"value":680,"toc":1342},"minimark",[681,685,690,693,700,711,715,718,731,737,740,746,750,753,767,770,778,782,785,790,793,804,807,810,816,823,829,833,836,841,844,850,861,867,873,879,882,888,894,900,904,907,913,916,922,928,934,944,950,953,959,972,975,981,987,993,997,1000,1006,1018,1024,1033,1039,1042,1048,1054,1060,1064,1067,1070,1076,1083,1089,1092,1098,1104,1110,1114,1120,1126,1129,1135,1141,1147,1150,1156,1162,1168,1177,1183,1186,1192,1198,1201,1207,1211,1214,1220,1238,1244,1247,1253,1259,1262,1268,1271,1277,1285,1289,1297,1301,1315,1319,1322,1327],[682,683,684],"p",{},"Like an array, a linked list is a linear data structure. This means that data elements are arranged in a way that one element is directly linked to its previous and next elements. There are different types of linked lists suited for different situations in software development; in this article we'll look at doubly-linked lists, their capabilites, and when you should use them.",[686,687,689],"h2",{"id":688},"what-is-a-linked-list","What is a linked list?",[682,691,692],{},"A linked list is a linear data structure in which data is not stored in adjacent memory locations. A node in a linked list has a data segment and a pointer pointing to the memory location of the next element; this continues until we get to the end of the list.",[682,694,695],{},[696,697],"img",{"alt":698,"src":699},"doubly linked list structure visual","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-001.png",[682,701,702,703,710],{},"You can learn more on the linked list ",[704,705,709],"a",{"href":706,"rel":707},"https:\u002F\u002Fwww.geeksforgeeks.org\u002Ftypes-of-linked-list\u002F?ref=lbp",[708],"nofollow","here",".",[686,712,714],{"id":713},"what-is-a-doubly-linked-list","What is a doubly linked list?",[682,716,717],{},"A doubly linked list is a variation of a linked list where each node of the linked list contains three separate parts:",[719,720,721,725,728],"ul",{},[722,723,724],"li",{},"A pointer to the previous node.",[722,726,727],{},"The data on the current node.",[722,729,730],{},"A pointer to the next node in the list.",[682,732,733],{},[696,734],{"alt":735,"src":736},"visual example of a node in a doubly linked list","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-002.png",[682,738,739],{},"Above is an example of a node in a doubly linked list.You can see how the differences in the nodes for a doubly linked list change the flow of data in the following diagram:",[682,741,742],{},[696,743],{"alt":744,"src":745},"diagram showing how nodes can change the flow of data for a doubly linked list","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-003.png",[686,747,749],{"id":748},"pros-and-cons-of-using-a-doubly-linked-list","Pros and cons of using a doubly linked list",[682,751,752],{},"Here are some advantages of a doubly linked list:",[719,754,755,758,761,764],{},[722,756,757],{},"Allows us to traverse in both directions, moving data forward and backwards.",[722,759,760],{},"It's easier to reverse a doubly linked list.",[722,762,763],{},"Inserting a new node is quicker.",[722,765,766],{},"Useful in implementing different data structures.",[682,768,769],{},"Here are some disadvantages of using a doubly linked list:",[719,771,772,775],{},[722,773,774],{},"Consumes extra memory due to the extra pointer.",[722,776,777],{},"For actions like insertion, both the previous pointer and the next pointer must be modified.",[686,779,781],{"id":780},"operations-on-doubly-linked-list","Operations on doubly linked list",[682,783,784],{},"In this section, we'll be looking at operations that are used to manipulate doubly linked lists.",[786,787,789],"h3",{"id":788},"creating","Creating",[682,791,792],{},"Before learning how to manipulate a doubly linked list, it’s important to first understand its creation. Below is the code for a creating the struct of a single node in a doubly linked list in C:",[794,795,800],"pre",{"className":796,"code":798,"language":799},[797],"language-text","struct node {\n  int data;\n  struct node *next;\n  struct node *prev;\n};\ntypedef struct node;\n","text",[801,802,798],"code",{"__ignoreMap":803},"",[682,805,806],{},"Here you can see that each node contains a variable to store an integer, a second variable to store the address of the next node, and a third variable to store the address of the previous node.",[682,808,809],{},"Now that the struct is declared, let's create our doubly linked list of nodes:",[794,811,814],{"className":812,"code":813,"language":799},[797],"\u002F* creating our nodes *\u002F\nnode *head;\nnode *first = NULL;\nnode *second = NULL;\nnode *third = NULL;\n\u002F* Allocate memory *\u002F\nfirst = malloc(sizeof(struct node));\nsecond = malloc(sizeof(struct node));\nthird = malloc(sizeof(struct node));\n\u002F* store address of the first node in head *\u002F\nhead = first;\n\u002F* Assign data values *\u002F\nfirst->data = 75;\nsecond->data = 85;\nthird->data = 100;\n\u002F* linking our nodes *\u002F\nfirst->next = two;\nfirst->prev = NULL;\nsecond->next = three;\nsecond->prev = one;\nthird->next = NULL;\nthird->prev = two;\n",[801,815,813],{"__ignoreMap":803},[682,817,818],{},[704,819,822],{"href":820,"rel":821},"https:\u002F\u002Fuser-a8d2af0a-e410-4d3e-985a-20f2fd9c570d-agyqaaz4hq-uc.a.run.app\u002F?p=83e74d917c",[708],"Save to Pieces",[682,824,825],{},[696,826],{"alt":827,"src":828},"image showing soubly linked list creation confirmation","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-004.png",[786,830,832],{"id":831},"inserting-a-node","Inserting a node",[682,834,835],{},"Two of the advantages of using a linked list instead of an array is the list’s ability to change size and how easy it is to insert new nodes. In this section, we'll look at how to add a new node into our list. Since there are different locations where nodes can be inserted, we will look at each case individually to understand them all well.",[837,838,840],"h4",{"id":839},"inserting-a-new-node-at-the-beginning","Inserting a new node at the beginning",[682,842,843],{},"To insert a node at the beginning of our doubly linked list we'll first have to create it and give it some value to store as data:",[794,845,848],{"className":846,"code":847,"language":799},[797],"\u002F* creating new node*\u002F\nnode *new_node = NULL;\n\u002F* Allocating memory for new node *\u002F\nnew_node = malloc(sizeof(struct node));\n\u002F* assigning data *\u002F\nnew_node->data = 105;\n",[801,849,847],{"__ignoreMap":803},[682,851,852,853,856,857,860],{},"To insert our newly created node at the beginning, we'll have to set the ",[801,854,855],{},"prev"," pointer of the new node to ",[801,858,859],{},"null"," and then set the next pointer of the new node to the first node in the list.",[794,862,865],{"className":863,"code":864,"language":799},[797],"new_node->prev = NULL;new_node->next = first;\n",[801,866,864],{"__ignoreMap":803},[682,868,869,870,872],{},"Now that there is a new node at the beginning of the list, set the ",[801,871,855],{}," pointer of the first node so that it points to the new node that was just created, and then set the head equal to the new node.",[794,874,877],{"className":875,"code":876,"language":799},[797],"first->prev = new_node;head = new_node;\n",[801,878,876],{"__ignoreMap":803},[682,880,881],{},"The following function can be used to insert a new node at the beginning of a doubly linked list:",[794,883,886],{"className":884,"code":885,"language":799},[797],"void insert_at_beginning(node** head, int data)\n{\n  \u002F\u002F allocate memory for new_node\n  node* new_node = NULL;\n  new_node = malloc(sizeof(struct node));\n  \u002F\u002F assign data to newNode\n  new_node->data = data;\n  \u002F\u002F point next of new_node to the first node of the doubly linked list\n  new_node->next = (*head);\n  \u002F\u002F point prev to NULL\n  new_node->prev = NULL;\n  \u002F\u002F point previous of the first node (now the first node is the second node) to new_node\n  if ((*head) != NULL)\n  (*head)->prev = new_node;\n  \u002F\u002F head points to newNode\n  (*head) = new_node;\n}\n",[801,887,885],{"__ignoreMap":803},[682,889,890],{},[704,891,822],{"href":892,"rel":893},"https:\u002F\u002Fuser-a8d2af0a-e410-4d3e-985a-20f2fd9c570d-agyqaaz4hq-uc.a.run.app\u002F?p=a95f4182a0",[708],[682,895,896],{},[696,897],{"alt":898,"src":899},"image showing after inserting a node at the start of the list","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-005.png",[837,901,903],{"id":902},"inserting-in-between-two-nodes","Inserting in between two nodes",[682,905,906],{},"To insert a node in between two nodes of our doubly linked list, we'll have to create the node before we place it:",[794,908,911],{"className":909,"code":910,"language":799},[797],"node *new_node = NULL;\n\u002F* Allocating memory for new node *\u002F\nnew_node = malloc(sizeof(struct node));\n\u002F* assigning data *\u002F\nnew_node->data = 124;\n",[801,912,910],{"__ignoreMap":803},[682,914,915],{},"We will then traverse through the list until we get to where we want to insert the new node. In the example below, we want to place our new node after the third node on the list.",[794,917,920],{"className":918,"code":919,"language":799},[797],"node *temp;\ntemp = *head;\nfor (i = 0; i \u003C 1; i++)\n  {\n    temp = temp->next;\n    if(temp == NULL)\n      return;\n  }\n",[801,921,919],{"__ignoreMap":803},[682,923,924,925,710],{},"After traversing down the list, the temp pointer refers to the second node with an index of one (1). Now we'll make the next pointer of the new node point to the third node. We can access the next node via ",[801,926,927],{},"temp->next",[794,929,932],{"className":930,"code":931,"language":799},[797],"new_node->next = temp->next;\n",[801,933,931],{"__ignoreMap":803},[682,935,936,937,939,940,943],{},"We'll then set the ",[801,938,855],{}," pointer of our new node point to the second node, which is referenced by ",[801,941,942],{},"temp",":",[794,945,948],{"className":946,"code":947,"language":799},[797],"new_node->prev = temp;\n",[801,949,947],{"__ignoreMap":803},[682,951,952],{},"Our new node now points to the third and fourth nodes. Now let's make the next pointer of our third node point to our new node and the prev pointer of our third node point to our new node.",[794,954,957],{"className":955,"code":956,"language":799},[797],"temp->next = new_node;temp->next->prev = new_node;\n",[801,958,956],{"__ignoreMap":803},[682,960,961,964,965,968,969,971],{},[801,962,963],{},"Temp"," refers to the second node while ",[801,966,967],{},"temp->next->prev"," refers to the ",[801,970,855],{}," pointer of the third node. With this done we have successfully inserted our new node in the second and third nodes of our list.",[682,973,974],{},"Here's the function for adding a new node at a specified position in a doubly linked list:",[794,976,979],{"className":977,"code":978,"language":799},[797],"void insertMid(node **head, int data)\n{\n  \u002F\u002F allocate memory for the new node\n  node *new_node, *temp;\n  int i;\n  new_node = malloc(sizeof(node));\n  new_node->data = data;\n  \u002F\u002F traversing through the list\n  temp = *head;\n  for (i = 0; i \u003C 2; i++)\n  {\n    temp = temp->next;\n    if(temp == NULL)\n      return;\n  }\n  \u002F\u002F inserting our new node\n  new_node->next = temp->next;\n  new_node->prev = temp;\n  temp->next = new_node;\n  temp->next->prev = new_node;\n}\n",[801,980,978],{"__ignoreMap":803},[682,982,983],{},[704,984,822],{"href":985,"rel":986},"https:\u002F\u002Fuser-a8d2af0a-e410-4d3e-985a-20f2fd9c570d-agyqaaz4hq-uc.a.run.app\u002F?p=647f4cb643",[708],[682,988,989],{},[696,990],{"alt":991,"src":992},"image showing after inserting a node in the middle of the list","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-006.png",[837,994,996],{"id":995},"inserting-a-new-node-at-the-end-of-the-list","Inserting a new node at the end of the list",[682,998,999],{},"To insert our node at the end of our list, we'll first have to create it:",[794,1001,1004],{"className":1002,"code":1003,"language":799},[797],"node *new_node = NULL;\n\u002F* Allocating memory for new node *\u002F\nnew_node = malloc(sizeof(struct node));\n\u002F* assigning data *\u002F\nnew_node->data = 136;\nWe'll then traverse down the list till we get to the end of the list:\nnode *temp;\ntemp = *head;\nwhile (temp->next != NULL)\n{\n  temp = temp->next;\n}\n",[801,1005,1003],{"__ignoreMap":803},[682,1007,1008,1009,1011,1012,1015,1016,943],{},"The ",[801,1010,942],{}," variable now refers to the last node. Now let's make the next pointer of the last node point to our ",[801,1013,1014],{},"new_node"," instead of ",[801,1017,859],{},[794,1019,1022],{"className":1020,"code":1021,"language":799},[797],"temp->next = new_node;\n",[801,1023,1021],{"__ignoreMap":803},[682,1025,1026,1027,1029,1030,1032],{},"Let's make the next pointer of our new node point to ",[801,1028,859],{}," and the ",[801,1031,855],{}," pointer point to the last node:",[794,1034,1037],{"className":1035,"code":1036,"language":799},[797],"new_node->prev = temp;new_node->next = NULL;\n",[801,1038,1036],{"__ignoreMap":803},[682,1040,1041],{},"With all of those steps completed, we have successfully added our new node to the end of our list. Here's what an entire function for adding a new node to the end of a doubly linked list would look like:",[794,1043,1046],{"className":1044,"code":1045,"language":799},[797],"void insertAtEnd(node **head, int data)\n{\n  node *new_node, *temp, *buf;\n  new_node = malloc(sizeof(node));\n  new_node->data = data;\n  temp = *head;\n  while (temp->next != NULL)\n  {\n    temp = temp->next;\n  }\n  temp->next = new_node;\n  new_node->prev = temp;\n  new_node->next = NULL;\n}\n",[801,1047,1045],{"__ignoreMap":803},[682,1049,1050],{},[704,1051,822],{"href":1052,"rel":1053},"https:\u002F\u002Fuser-a8d2af0a-e410-4d3e-985a-20f2fd9c570d-agyqaaz4hq-uc.a.run.app\u002F?p=a8f8428fbe",[708],[682,1055,1056],{},[696,1057],{"alt":1058,"src":1059},"image showing after inserting a node at the end of the list","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-007.png",[786,1061,1063],{"id":1062},"updating-a-node","Updating a node",[682,1065,1066],{},"With our list created, let's look at how we update a specific node located inside of a doubly linked list. In the example below we'll be editing the 3rd node with an index of 2 in our list.",[682,1068,1069],{},"First, we'll traverse down the list to the third node that we would like to update:",[794,1071,1074],{"className":1072,"code":1073,"language":799},[797],"node *temp;\ntemp = *head;\nfor (i = 0; i \u003C 2; i++)\n{\n  temp = temp->next;\n  if(temp == NULL)\n     return;\n}\n",[801,1075,1073],{"__ignoreMap":803},[682,1077,1078,1079,1082],{},"Now, all we have to do is declare ",[801,1080,1081],{},"temp->data"," and set a specific value:",[794,1084,1087],{"className":1085,"code":1086,"language":799},[797],"temp->next = 36;\n",[801,1088,1086],{"__ignoreMap":803},[682,1090,1091],{},"Here's what the function for updating a node to the end of a doubly linked list would look like:",[794,1093,1096],{"className":1094,"code":1095,"language":799},[797],"void updateNode(node **head, int data)\n{\n  node *temp, *buf;\n  int i;\n  temp = *head;\n  for (i = 0; i \u003C 2; i++)\n  {\n    temp = temp->next;\n    if(temp == NULL)\n      return;\n  }\n  temp->data = data;\n}\n",[801,1097,1095],{"__ignoreMap":803},[682,1099,1100],{},[704,1101,822],{"href":1102,"rel":1103},"https:\u002F\u002Fuser-a8d2af0a-e410-4d3e-985a-20f2fd9c570d-agyqaaz4hq-uc.a.run.app\u002F?p=dbfe43a132",[708],[682,1105,1106],{},[696,1107],{"alt":1108,"src":1109},"image showing after updating a node","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-008.png",[786,1111,1113],{"id":1112},"deleting-a-node","Deleting a node",[682,1115,1116,1117,1119],{},"To delete a node after a specified node in our list, we'll first create a ",[801,1118,942],{}," node for traversing down the list until we get to our node:",[794,1121,1124],{"className":1122,"code":1123,"language":799},[797],"node *temp;temp = *head;\n",[801,1125,1123],{"__ignoreMap":803},[682,1127,1128],{},"Now we'll traverse down the list.",[794,1130,1133],{"className":1131,"code":1132,"language":799},[797],"while(temp->data != val)temp = temp->next;\n",[801,1134,1132],{"__ignoreMap":803},[682,1136,1137,1138,1140],{},"This sets ",[801,1139,942],{}," to the node before the node we intend to delete. Now we'll create a new pointer and point to the node we intend to delete:",[794,1142,1145],{"className":1143,"code":1144,"language":799},[797],"node *ptr;ptr = temp->next;\n",[801,1146,1144],{"__ignoreMap":803},[682,1148,1149],{},"With this completed, the pointer now refers to the node that will be deleted. Now we'll make the next pointer of the specified node point to the node after the node we intend to delete:",[794,1151,1154],{"className":1152,"code":1153,"language":799},[797],"temp->next = ptr->next;\n",[801,1155,1153],{"__ignoreMap":803},[682,1157,1158,1159,1161],{},"To completely disconnect the node that we’re deleting from our list, we'll set the ",[801,1160,855],{}," node of the pointer after the one we want to delete to the specified node:",[794,1163,1166],{"className":1164,"code":1165,"language":799},[797],"ptr->next->prev = temp;\n",[801,1167,1165],{"__ignoreMap":803},[682,1169,1170,1171,1174,1175,710],{},"With everything completed, the ",[801,1172,1173],{},"ptr"," has been disconnected from our list and all we need to do is release the memory that was allocated to ",[801,1176,1173],{},[794,1178,1181],{"className":1179,"code":1180,"language":799},[797],"free(ptr);\n",[801,1182,1180],{"__ignoreMap":803},[682,1184,1185],{},"Here's the entire function for deleting a node to the end of a doubly linked list. It can be used regardless of the list’s length:",[794,1187,1190],{"className":1188,"code":1189,"language":799},[797],"void deleteNode(node **head)\n{\n  node *ptr, *temp, *buf;\n  int val;\n  temp = *head;\n  val = 75;\n  while(temp -> data != val)\n    temp = temp->next;\n    ptr = temp->next;\n    temp->next = ptr->next;\n    ptr->next->prev = temp;\n  free(ptr);\n}\n",[801,1191,1189],{"__ignoreMap":803},[682,1193,1194],{},[704,1195,822],{"href":1196,"rel":1197},"https:\u002F\u002Fuser-a8d2af0a-e410-4d3e-985a-20f2fd9c570d-agyqaaz4hq-uc.a.run.app\u002F?p=1b8a499fc6",[708],[682,1199,1200],{},"In the function above, we deleted the node directly after the node with a value of 75.",[682,1202,1203],{},[696,1204],{"alt":1205,"src":1206},"image showing after deleting a node","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-009.png",[786,1208,1210],{"id":1209},"reversing-a-doubly-linked-list","Reversing a doubly linked list",[682,1212,1213],{},"To reverse a doubly linked list, we'll start by taking the two pointers:",[794,1215,1218],{"className":1216,"code":1217,"language":799},[797],"node *temp, *buf;\n",[801,1219,1217],{"__ignoreMap":803},[682,1221,1222,1223,1226,1227,1230,1231,1233,1234,1237],{},"Now let ",[801,1224,1225],{},"buf"," point to ",[801,1228,1229],{},"NULL"," while ",[801,1232,942],{}," points to our ",[801,1235,1236],{},"head"," pointer:",[794,1239,1242],{"className":1240,"code":1241,"language":799},[797],"buf = NULL;temp = *head;\n",[801,1243,1241],{"__ignoreMap":803},[682,1245,1246],{},"In a loop using both pointers, swap the next and previous pointer for all nodes of the doubly linked list:",[794,1248,1251],{"className":1249,"code":1250,"language":799},[797],"while (temp != NULL)\n{\n  buf = temp->prev;\n  temp->prev = temp->next;\n  temp->next = buf;\n  temp = temp->prev;\n}\n",[801,1252,1250],{"__ignoreMap":803},[682,1254,1255],{},[704,1256,822],{"href":1257,"rel":1258},"https:\u002F\u002Fuser-a8d2af0a-e410-4d3e-985a-20f2fd9c570d-agyqaaz4hq-uc.a.run.app\u002F?p=92884295a2",[708],[682,1260,1261],{},"With these done, our previous and next pointers has been swapped. Now we'll set the head pointer to the last node of the list.",[682,1263,1264],{},[696,1265],{"alt":1266,"src":1267},"image showing after reversing a node","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-010.png",[682,1269,1270],{},"With all these done, here's the output of all of our operations.",[682,1272,1273],{},[696,1274],{"alt":1275,"src":1276},"image showing the output of all of the node operations","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fimg-011.png",[682,1278,1279,1280,710],{},"You can get the code for all our functions from the ",[704,1281,1284],{"href":1282,"rel":1283},"https:\u002F\u002Fgithub.com\u002FKing-AJr\u002Fdoubly_linked_list",[708],"repo",[686,1286,1288],{"id":1287},"time-complexities-for-operations-with-doubly-linked-lists","Time complexities for operations with doubly linked lists",[719,1290,1291,1294],{},[722,1292,1293],{},"Operations without traversal has a time complexity of O(1). (Inserting at the beginning of the list.)",[722,1295,1296],{},"Operations that involve traversal that requires traversal has a time complexity of O(n). (Deleting and updating nodes other than the first, reversing the list.)",[686,1298,1300],{"id":1299},"applications-of-doubly-linked-lists","Applications of doubly linked lists",[719,1302,1303,1306,1309,1312],{},[722,1304,1305],{},"Redo and undo functionality in software.",[722,1307,1308],{},"Implementation of stacks and queues.",[722,1310,1311],{},"Forward and backward navigation in browsers.",[722,1313,1314],{},"Navigation systems where forward and backward navigation is required.",[686,1316,1318],{"id":1317},"conclusion","Conclusion",[682,1320,1321],{},"In this article, we looked at doubly linked lists and the different operations we can carry out on a doubly linked list to modify, create, and remove nodes to efficiently work with the data moving through them. Happy coding!",[682,1323,1324],{},[1325,1326,27],"strong",{},[719,1328,1329,1335],{},[722,1330,1331],{},[704,1332,1334],{"href":1282,"rel":1333},[708],"Code repo",[722,1336,1337],{},[704,1338,1341],{"href":1339,"rel":1340},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FLinked_list?wprov=sfla1",[708],"Linked list",{"title":803,"searchDepth":1343,"depth":1343,"links":1344},2,[1345,1346,1347,1348,1356,1357,1358],{"id":688,"depth":1343,"text":689},{"id":713,"depth":1343,"text":714},{"id":748,"depth":1343,"text":749},{"id":780,"depth":1343,"text":781,"children":1349},[1350,1352,1353,1354,1355],{"id":788,"depth":1351,"text":789},3,{"id":831,"depth":1351,"text":832},{"id":1062,"depth":1351,"text":1063},{"id":1112,"depth":1351,"text":1113},{"id":1209,"depth":1351,"text":1210},{"id":1287,"depth":1343,"text":1288},{"id":1299,"depth":1343,"text":1300},{"id":1317,"depth":1343,"text":1318},"Software Development","2022-12-08T00:00:00.000Z","There are different types of linked lists. In this article we'll look at what a doubly linked list is capable of and when you should use one.",false,"md","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists\u002Fhero.jpeg","decorative header image showing a doubly linked list diagram",{},"\u002Fblog\u002Feverything-you-need-to-know-about-doubly-linked-lists",{"title":673,"description":1361},"blog\u002Feverything-you-need-to-know-about-doubly-linked-lists",[1371],"lists; data-4","rM31ZP747GSUno6LGEA9E1wUfzZUlV9PwaxDzwMHJQw",{"id":1374,"title":674,"body":1375,"description":803,"draft":1362,"extension":1363,"meta":1379,"navigation":32,"path":1380,"photo":1381,"photoAlt":676,"seo":1382,"stem":1383,"__hash__":1384},"authors\u002Fauthors\u002Fking-aj.md",{"type":679,"value":1376,"toc":1377},[],{"title":803,"searchDepth":1343,"depth":1343,"links":1378},[],{},"\u002Fauthors\u002Fking-aj","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fauthors\u002Fplaceholder.svg",{"title":674,"description":803},"authors\u002Fking-aj","R6fsaH9lhk3AQrqOoA9AwxLJjbn0YW0L6yaelT52Wr4",{"left":1386,"top":1386,"width":1387,"height":1387,"rotate":1386,"vFlip":1362,"hFlip":1362,"body":1388},0,24,"\u003Cpath fill=\"currentColor\" d=\"m7.825 13l4.9 4.9q.3.3.288.7t-.313.7q-.3.275-.7.288t-.7-.288l-6.6-6.6q-.15-.15-.213-.325T4.426 12t.063-.375t.212-.325l6.6-6.6q.275-.275.688-.275t.712.275q.3.3.3.713t-.3.712L7.825 11H19q.425 0 .713.288T20 12t-.288.713T19 13z\"\u002F>"]