Stack Exchange
open access
CC BY-SA
One Stack, Two Queues
background Several years ago, when I was an undergraduate, we were given a homework on amortized analysis. I was unable to solve one of the problems. I had asked it in comp.theory, but no satisfactory result came up. I remember the course TA insisted on something he couldn't prove, and said he forgot the proof, and... [you know what]. Today, I recalled the problem. I was still eager to know, so here it is... The Question Is it possible to implement a stack using two queues, so that both PUSH and POP operations run in amortized time O(1)? If yes, could you tell me how? Note: The situation is quite easy if we want to implement a queue with two stacks (with corresponding operations ENQUEUE & DEQUEUE ). Please observe the difference. PS: The above problem is not the homework itself. The homework did not require any lower bounds; just an implementation and the running time analysis.
Conceptio Open Archive
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
This document is indexed with metadata only: full text is not available in the archive for this record. Open the official source ↗
Related documents
- A Memory-Magic Exchange Law in Streaming Clifford+T Compilation#1143895
- Early Mobilisation and Relational Touch Practice on Intubated Patients of Intensive Care Unit#1096047
- Effect of Metformin on Endometrial Thickness in Postmenopausal Breast Cancer Patients Receiving Tamoxifen#1126470
- How are variables stored in and retrieved from the program stack?#796601
- FOURTH PILLAR: ACTIVE MEMORY ENGINEERING AND TRAJECTORY-LEVEL ADEQUACY IN OPEN SYSTEM#82514
Record · ID 787542
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Bring this data into your agent: Connect via MCP or API · 20 free credits to start · no card required
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive