4 views

Uploaded by djoseph_1

from MIT OCW

save

- 2014_04_msw_a4_format
- ModelSim®-Command-Reference-Manual-v10.3a
- 2014_04_msw_a4_format
- Guide Part 2
- Microsoft Excel 2007 to 2010
- 2004 Gori Icpr
- An Introduction to Combinatorics and Graph Theory
- ETRI Journal Author Guide
- SM
- Knuth - Mathematical Writing
- Dynamic
- 1011SEM2- GEK1505
- Graph500 BigData2016 Paper
- Networkx Reference
- Maths Answers
- Bron Kerbosh Ncliques
- Paper Template
- Summarizing Paraphrasing and Quoting
- Hoffman–Singleton Graph _ Visual Insight
- Cisco Commands
- A Comprehensive Introduction to the Theory of Word-Representable Graphs
- A Survey: Hypergraph Partitioning Techniques
- Elliott Wave
- MATHEMATICAL COMBINATORICS (INTERNATIONAL BOOK SERIES), Volume 4 / 2009
- Gr11,T1,Math HL,P1, 2015 (QP)
- D. Mukhopadhyay, P. Joshi and D. RoyChowdhury- VLSI Architecture of a Cellular Automata based One-Way Function
- In t Ructions Mau a Leng
- Guidelines
- Kschischang Frey Loeliger - Factor Graphs and the Sum Product Algorithm
- Paper 4 Quantitative
- Aproveitamento de Cinzas Pesadas de Carvão Mineral Em Massas Cerâmicas de Revestimento e Verificação Das Propriedades Físicas Pós Sinterização
- Dico Familias
- Test Bank for Strategic Corporate Social Responsibility Sustainable Value Creation 4th Edition by David Chandler
- Cheque
- Matemáticas
- Jerry Kece
- Acuerdo 442. SNB
- Presentation Etbis
- DayOne_v1.0.pdf
- Our Local Heritage_Roccaforte Del Greco (RC, Italy)
- Teoría Creacionista o Fijista
- Ciri
- Sentimientos del mexicano antes de las elecciones
- sbmptn
- Key Words for Fluency Pre-Intermediate
- MEC LOBO
- Imperio Incaico
- Lirica Ccc
- 1. DAMPAK ROKOK
- Hw2s18 Ans
- O valor é R$ 349,99 POR qualquer TCC OU MONOGRAFIA WHATSAPP (21)974111465 (59)--.pdf
- Contoh Form Asuhan Pasien Lanjutan 2
- Weredtdyf4yg54162
- 1er Examen de Histologia 2006-2
- Doc1
- Word_Stress_2012.pdf
- Document (1) (1)
- Arl Bolivar Riesgos Publicos
- vibracoes -manutenção preditiva.pdf
- Dampak Industri terhadap lingkungan
- MIT9 85F12 Proposal
- MIT6_851S12_ps4sol
- MIT9 85F12 Final Project
- MIT21M_030S13_exam1review
- MIT6_851S12_ps3
- MIT9 85F12 Practicum
- MIT6_851S12_ps4
- MIT21M_030S13_exam2review
- MIT6_851S12_ps2sol
- MIT9_85F12_brochureblank
- MIT6_851S12_ps5
- MIT9 85F12 Cr Tips
- MIT9 85F12 Brochure
- MIT6_851S12_ps3sol
- MIT9 85F12 Cr Guidelines
- MIT6_851S12_ps7
- MIT6_851S12_ps7sol
- MIT6_851S12_ps2
- MIT6_851S12_ps8sol
- MIT6_851S12_ps9sol
- MIT6_851S12_ps5sol
- MIT17_871S12_Intro
- MIT6_851S12_ps1s
- MIT6_851S12_ps1
- MIT6_851S12_ps9
- MIT6_851S12_ps6
- MIT6_851S12_ps6sol
- MIT6_851S12_ps10
- MIT6_851S12_ps8

You are on page 1of 2

**Erik Demaine Problem 10
**

Compact balanced parentheses. 1. Construct a graph G with a vertex for each block, and an edge between the the block containing each parenthesis and the block containing its match. Observe that G is a simple graph, since if two pioneer parenthesis lie in the same block, their matching parens cannot also lie in the same block. We construct the following planar embedding for this graph: place the vertices in order along a horizontal line, and draw the edges below this line such that the edges do not cross. This is possible because of the nesting property that the parenthesis pairs must obey. Since a planar embedding exists, G is a planar graph and thus the number of edges is at most three times the number of vertices. There are |S |/B vertices, and there is a bijection between the edges and pioneer parenthesis, thus there are at most 3|S |/B = O(|S |/B ) pioneer parenthesis, as desired. For the tight bound of 2|S |/B − 3, observe that this graph is also an outerplanar graph (as shown by the same embedding). 2. • Divide S into blocks of size B = 1/2 lg |S |. • Make a table giving the block containing the matching parenthesis of each pioneer parenthesis. • Make a rank data structure over the bit vector of pioneer parenthesis (1 for pioneer, 0 otherwise). • Make a rank data structure over the open parens in S , and another over the close parens in S . a • Make a lookup table T1 which given a block and an index into the block ( |S |∗ 1/2 lg |S | possibilities) returns its matching paren if it is in the block, or say it isn’t there. • Make a a lookup table T2 which given a block and an integer k between −B and B ( |S | ∗ lg |S | possibilities) return the ﬁrst closing paren in the block such that the number of open parens minus the number of closing parens in the block up to that paren equals k . To do query on a paren p, ﬁrst check T1 for its block, if its closing paren is there, then return it. Otherwise, use rank over pioneers to look into the pioneer table to ﬁnd which block b p’s matching paren is in. Then use T2 for b with k equal to the diﬀerence between the number of open parens and the number of close parens up to p minus diﬀerence between the number of open parens and the number of close parens up to b (computed using rank over open paren and rank over close paren structures).

Sample solution

1

mit. .MIT OpenCourseWare http://ocw. visit: http://ocw.edu 6.edu/terms.mit.851 Advanced Data Structures Spring 2012 For information about citing these materials or our Terms of Use.

- 2014_04_msw_a4_formatUploaded byLucas Carrafa
- ModelSim®-Command-Reference-Manual-v10.3aUploaded bykirito
- 2014_04_msw_a4_formatUploaded byRavendra Singh
- Guide Part 2Uploaded byMuhamad Syukron
- Microsoft Excel 2007 to 2010Uploaded byTariku Gebremedhin
- 2004 Gori IcprUploaded byMaz Har Ul
- An Introduction to Combinatorics and Graph TheoryUploaded byrsmxingu
- ETRI Journal Author GuideUploaded byteocci
- SMUploaded byArpita Sengupta
- Knuth - Mathematical WritingUploaded byZienhong
- DynamicUploaded byBhavini Rajendrakumar Bhatt
- 1011SEM2- GEK1505Uploaded byWai-Yen Chan
- Graph500 BigData2016 PaperUploaded byMiguel Angel
- Networkx ReferenceUploaded bychandu
- Maths AnswersUploaded byBoomm Boomit
- Bron Kerbosh NcliquesUploaded bymouhabalde
- Paper TemplateUploaded byAnban Guna
- Summarizing Paraphrasing and QuotingUploaded byretno pidekso
- Hoffman–Singleton Graph _ Visual InsightUploaded byVladimir Pelekhaty
- Cisco CommandsUploaded byKarthiAs
- A Comprehensive Introduction to the Theory of Word-Representable GraphsUploaded byJohn Bird
- A Survey: Hypergraph Partitioning TechniquesUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Elliott WaveUploaded byYoderIII
- MATHEMATICAL COMBINATORICS (INTERNATIONAL BOOK SERIES), Volume 4 / 2009Uploaded byscience2010
- Gr11,T1,Math HL,P1, 2015 (QP)Uploaded byTheijan Baburaj
- D. Mukhopadhyay, P. Joshi and D. RoyChowdhury- VLSI Architecture of a Cellular Automata based One-Way FunctionUploaded byIrokk
- In t Ructions Mau a LengUploaded byGucox
- GuidelinesUploaded byFarin Kazi
- Kschischang Frey Loeliger - Factor Graphs and the Sum Product AlgorithmUploaded byMauro Sellitto
- Paper 4 QuantitativeUploaded byHAFIZ IMRAN AKHTER

- MIT9 85F12 ProposalUploaded bydjoseph_1
- MIT6_851S12_ps4solUploaded bydjoseph_1
- MIT9 85F12 Final ProjectUploaded bydjoseph_1
- MIT21M_030S13_exam1reviewUploaded bydjoseph_1
- MIT6_851S12_ps3Uploaded bydjoseph_1
- MIT9 85F12 PracticumUploaded bydjoseph_1
- MIT6_851S12_ps4Uploaded bydjoseph_1
- MIT21M_030S13_exam2reviewUploaded bydjoseph_1
- MIT6_851S12_ps2solUploaded bydjoseph_1
- MIT9_85F12_brochureblankUploaded bydjoseph_1
- MIT6_851S12_ps5Uploaded bydjoseph_1
- MIT9 85F12 Cr TipsUploaded bydjoseph_1
- MIT9 85F12 BrochureUploaded bydjoseph_1
- MIT6_851S12_ps3solUploaded bydjoseph_1
- MIT9 85F12 Cr GuidelinesUploaded bydjoseph_1
- MIT6_851S12_ps7Uploaded bydjoseph_1
- MIT6_851S12_ps7solUploaded bydjoseph_1
- MIT6_851S12_ps2Uploaded bydjoseph_1
- MIT6_851S12_ps8solUploaded bydjoseph_1
- MIT6_851S12_ps9solUploaded bydjoseph_1
- MIT6_851S12_ps5solUploaded bydjoseph_1
- MIT17_871S12_IntroUploaded bydjoseph_1
- MIT6_851S12_ps1sUploaded bydjoseph_1
- MIT6_851S12_ps1Uploaded bydjoseph_1
- MIT6_851S12_ps9Uploaded bydjoseph_1
- MIT6_851S12_ps6Uploaded bydjoseph_1
- MIT6_851S12_ps6solUploaded bydjoseph_1
- MIT6_851S12_ps10Uploaded bydjoseph_1
- MIT6_851S12_ps8Uploaded bydjoseph_1