SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Data Structures and Algorithm Analysis
Spring 2020 Post Midterm Exam – 100 points + 10 bonus
NAME:
1. How much memory will the following structures take up?
Hint: int takes 4 bytes, float takes 4 bytes, char takes 1 byte. – 9
points
a. struct Structure1 {int a,b,c,d,e[10]; float f;};
b. struct Structure2 {int a[12]; float b[5];};
c. struct Structure3 {char a[10][12][4], b[5][5], c[10];};
2. Show the steps when sorting (smallest to largest) the
following arrays of numbers using selection sort i.e. every time
a swap occurs, show what the current state of the array looks
like, including the final sorted array. – 12 points
a. [10, 2, 5, 8, 9, 1, 4, 7]
b. [7, 1, 3, 2, 5, 4, 8, 12, 9]
c. [8, 7, 6, 5, 4, 3, 2, 1]
d. [5, 3, 8, 1, 9, 4, 2, 6]
3. Big-O: What is meant by f(n) = O(g(n))? Give the definition
and then explain what it means in your own terms. – 5 points
4. Big-Omega: What is meant by f(n) = Ω(g(n))? Give the
definition and then explain what it means in your own terms. –
5 points
5. Show that , make sure you use the definition and justify the
inequalities and constants used. - 4 points
6. Show that , make sure you use the definition and justify the
inequalities and constants used. - 4 points
7. Show that , make sure you use the definition and justify the
inequalities and constants used. - 4 points
8. Show that , make sure you use the definition and justify the
inequalities and constants used. - 4 points
9. Show that , make sure you use the definition and justify the
inequalities and constants used. - 4 points
10. What principle governs how you add/remove elements in a
stack? Spell it out and briefly explain. - 4 points
11. Briefly describe an application of a stack. - 4 points
12. What principle governs how you add/remove elements in a
queue? Spell it out and briefly explain. - 4 points
13. Briefly describe an application of a queue. - 4 points
Consider the following graph (pseudocode for BFS and DFS
given on page 9):
14. Write the order in which the nodes would be visited in when
doing a breadth first search (BFS) traversal starting at node 4.
Also, write the distances from 4 to every other node. - 6 points
15. Write the order in which the nodes would be visited in when
doing a breadth first search (BFS) traversal starting at node 5.
Also, write the distances from 5 to every other node. - 6 points
Same graph (for your convenience):
16. Write the order in which the nodes would be visited in when
doing a depth first search (DFS) traversal starting at node 4
(order discovered or order off the stack). - 6 points
17. Write the order in which the nodes would be visited in when
doing a depth first search (DFS) traversal starting at node 5
(order discovered or order off the stack). - 6 points
18. Give the definition of a graph. - 5 points
19. Give the definition of a tree (from graph theory). - 4 points
BFS Pseudocode (for graph with n vertices):
Input: grapharray[n][n], source
queue<int> Q
int distance[n] (array to keep track of nodes distances (from
source), all values set to -1 except source which is set to 0 i.e. -
1 = not visited)
Q.push(source)
while(Q is not empty)
v = Q.front
Q.pop()
for each neighbor w of v
if distance[w] = -1
print w
distance[w] = distance[v]+1
Q.push(w)
end if
end for
end while
DFS Pseudocode (for graph with n vertices):
Input: grapharray[n][n], source
stack<int> S
int visited[n] (array to keep track of nodes visited, all values set
to 0 except source which is set to 1 i.e. 0 = not visited, 1 =
visited)
S.push(source)
while(S is not empty)
v = S.top
S.pop()
for each neighbor w of v
if visited[w] = 0
print w
visited[w] = 1
S.push(w)
end if
end for
end while
Bonus (4 points): Show all of the steps (splitting and merging)
when using mergesort to sort (smallest to largest) the following
array (they are the numbers 1 through 16):
[16, 1, 15, 2, 14, 3, 13, 4, 12, 5, 11, 6, 10, 7, 9, 8]
Bonus (2 points): describe how you could implement a queue
using 2 stacks.
Bonus (4 points) Draw the binary search tree that would be
constructed by inserting the following values in the exact order
given (starting with an empty tree i.e. first value will be the
first node in the tree): -
a. Binary Search Tree A: 8, 9, 2, 7, 1, 10, 3, 5, 6, 4
b. Binary Search Tree B: 10, 7, 9, 12, 4, 2, 5, 3, 1, 14, 11, 19,
13, 18, 20
11

Weitere ähnliche Inhalte

Ähnlich wie Data Structures and Algorithm AnalysisSpring 2020 Post Midterm E

graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxgraphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
whittemorelucilla
 
bfs tree searching ,sortingUntitled presentation.pptx
bfs tree searching ,sortingUntitled presentation.pptxbfs tree searching ,sortingUntitled presentation.pptx
bfs tree searching ,sortingUntitled presentation.pptx
saurabhpandey679381
 
lecture 17
lecture 17lecture 17
lecture 17
sajinsc
 
1 Compute and draw the adjacency matrix and adjacency list .pdf
1 Compute and draw the adjacency matrix and adjacency list .pdf1 Compute and draw the adjacency matrix and adjacency list .pdf
1 Compute and draw the adjacency matrix and adjacency list .pdf
atwaytvl
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
carliotwaycave
 

Ähnlich wie Data Structures and Algorithm AnalysisSpring 2020 Post Midterm E (20)

DFS and BFS
DFS and BFSDFS and BFS
DFS and BFS
 
2.5 bfs & dfs 02
2.5 bfs & dfs 022.5 bfs & dfs 02
2.5 bfs & dfs 02
 
Graphs
GraphsGraphs
Graphs
 
LEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdfLEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdf
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding Algorithms
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxgraphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
 
bfs tree searching ,sortingUntitled presentation.pptx
bfs tree searching ,sortingUntitled presentation.pptxbfs tree searching ,sortingUntitled presentation.pptx
bfs tree searching ,sortingUntitled presentation.pptx
 
lecture 17
lecture 17lecture 17
lecture 17
 
Parallel search
Parallel searchParallel search
Parallel search
 
1 Compute and draw the adjacency matrix and adjacency list .pdf
1 Compute and draw the adjacency matrix and adjacency list .pdf1 Compute and draw the adjacency matrix and adjacency list .pdf
1 Compute and draw the adjacency matrix and adjacency list .pdf
 
Graphs bfs dfs
Graphs bfs dfsGraphs bfs dfs
Graphs bfs dfs
 
Building a Functional Stream in Scala
Building a Functional Stream in ScalaBuilding a Functional Stream in Scala
Building a Functional Stream in Scala
 
hospital management
hospital managementhospital management
hospital management
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questions
 
Graphs
GraphsGraphs
Graphs
 
Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
 
Breadth first search
Breadth first search Breadth first search
Breadth first search
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 

Mehr von jeniihykdevara

Hide Folder InformationThis project is due in about 3 12 hour.docx
Hide Folder InformationThis project is due in about 3 12 hour.docxHide Folder InformationThis project is due in about 3 12 hour.docx
Hide Folder InformationThis project is due in about 3 12 hour.docx
jeniihykdevara
 

Mehr von jeniihykdevara (20)

hiExplain what is Hadoop, how its fit into the Data Wareho.docx
hiExplain what is Hadoop, how its fit into the Data Wareho.docxhiExplain what is Hadoop, how its fit into the Data Wareho.docx
hiExplain what is Hadoop, how its fit into the Data Wareho.docx
 
Hide Folder InformationThis project is due in about 3 12 hour.docx
Hide Folder InformationThis project is due in about 3 12 hour.docxHide Folder InformationThis project is due in about 3 12 hour.docx
Hide Folder InformationThis project is due in about 3 12 hour.docx
 
Hi,  i have a draft of my paper about technology need to be fina.docx
Hi,  i have a draft of my paper about technology need to be fina.docxHi,  i have a draft of my paper about technology need to be fina.docx
Hi,  i have a draft of my paper about technology need to be fina.docx
 
Hi,Write a narrative essay.The topic for this essay Write a.docx
Hi,Write a narrative essay.The topic for this essay Write a.docxHi,Write a narrative essay.The topic for this essay Write a.docx
Hi,Write a narrative essay.The topic for this essay Write a.docx
 
Hi,The paper is Masters degree level. Must be written in APA styl.docx
Hi,The paper is Masters degree level. Must be written in APA styl.docxHi,The paper is Masters degree level. Must be written in APA styl.docx
Hi,The paper is Masters degree level. Must be written in APA styl.docx
 
High and Low Context CommunicationResearch high and low context co.docx
High and Low Context CommunicationResearch high and low context co.docxHigh and Low Context CommunicationResearch high and low context co.docx
High and Low Context CommunicationResearch high and low context co.docx
 
Hi,Please answer all three questions below, also attached textbook.docx
Hi,Please answer all three questions below, also attached textbook.docxHi,Please answer all three questions below, also attached textbook.docx
Hi,Please answer all three questions below, also attached textbook.docx
 
Hi,Please find attached the article and answer the question below.docx
Hi,Please find attached the article and answer the question below.docxHi,Please find attached the article and answer the question below.docx
Hi,Please find attached the article and answer the question below.docx
 
Hi,I want a report about the uploaded case study. These are the .docx
Hi,I want a report about the uploaded case study. These are the .docxHi,I want a report about the uploaded case study. These are the .docx
Hi,I want a report about the uploaded case study. These are the .docx
 
Hi,I need someone to implement my paper in part of1.result&discu.docx
Hi,I need someone to implement my paper in part of1.result&discu.docxHi,I need someone to implement my paper in part of1.result&discu.docx
Hi,I need someone to implement my paper in part of1.result&discu.docx
 
Hi,I have a book discussion in my literature class, the book is .docx
Hi,I have a book discussion in my literature class, the book is .docxHi,I have a book discussion in my literature class, the book is .docx
Hi,I have a book discussion in my literature class, the book is .docx
 
Hi,I got two summaries. Each summary is ONE PAGE.The first.docx
Hi,I got two summaries. Each summary is ONE PAGE.The first.docxHi,I got two summaries. Each summary is ONE PAGE.The first.docx
Hi,I got two summaries. Each summary is ONE PAGE.The first.docx
 
Hi, I need this assingment by tomorrow 12415 at 1159PM. I hav.docx
Hi, I need this assingment by tomorrow 12415 at 1159PM. I hav.docxHi, I need this assingment by tomorrow 12415 at 1159PM. I hav.docx
Hi, I need this assingment by tomorrow 12415 at 1159PM. I hav.docx
 
Hi, I need this discussion question answered by 1159pm tomorrow Fri.docx
Hi, I need this discussion question answered by 1159pm tomorrow Fri.docxHi, I need this discussion question answered by 1159pm tomorrow Fri.docx
Hi, I need this discussion question answered by 1159pm tomorrow Fri.docx
 
Hi,I have three article, what I need is a one page summary of a .docx
Hi,I have three article, what I need is a one page summary of a .docxHi,I have three article, what I need is a one page summary of a .docx
Hi,I have three article, what I need is a one page summary of a .docx
 
Hi, I need help writing an art history paper wondering if you could .docx
Hi, I need help writing an art history paper wondering if you could .docxHi, I need help writing an art history paper wondering if you could .docx
Hi, I need help writing an art history paper wondering if you could .docx
 
Hi, I need help with my papers but I need someone with experience in.docx
Hi, I need help with my papers but I need someone with experience in.docxHi, I need help with my papers but I need someone with experience in.docx
Hi, I need help with my papers but I need someone with experience in.docx
 
Hi, I have an assignment in my religion class, I have uploaded the i.docx
Hi, I have an assignment in my religion class, I have uploaded the i.docxHi, I have an assignment in my religion class, I have uploaded the i.docx
Hi, I have an assignment in my religion class, I have uploaded the i.docx
 
Hi, I need a 3-3.5 page paper about 2 books and a text. First book .docx
Hi, I need a 3-3.5 page paper about 2 books and a text. First book .docxHi, I need a 3-3.5 page paper about 2 books and a text. First book .docx
Hi, I need a 3-3.5 page paper about 2 books and a text. First book .docx
 
Hi, I have an assignment in my behavior in organization class, its .docx
Hi, I have an assignment in my behavior in organization class, its .docxHi, I have an assignment in my behavior in organization class, its .docx
Hi, I have an assignment in my behavior in organization class, its .docx
 

Kürzlich hochgeladen

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 

Data Structures and Algorithm AnalysisSpring 2020 Post Midterm E

  • 1. Data Structures and Algorithm Analysis Spring 2020 Post Midterm Exam – 100 points + 10 bonus NAME: 1. How much memory will the following structures take up? Hint: int takes 4 bytes, float takes 4 bytes, char takes 1 byte. – 9 points a. struct Structure1 {int a,b,c,d,e[10]; float f;}; b. struct Structure2 {int a[12]; float b[5];}; c. struct Structure3 {char a[10][12][4], b[5][5], c[10];}; 2. Show the steps when sorting (smallest to largest) the following arrays of numbers using selection sort i.e. every time a swap occurs, show what the current state of the array looks like, including the final sorted array. – 12 points a. [10, 2, 5, 8, 9, 1, 4, 7]
  • 2. b. [7, 1, 3, 2, 5, 4, 8, 12, 9] c. [8, 7, 6, 5, 4, 3, 2, 1] d. [5, 3, 8, 1, 9, 4, 2, 6]
  • 3. 3. Big-O: What is meant by f(n) = O(g(n))? Give the definition and then explain what it means in your own terms. – 5 points 4. Big-Omega: What is meant by f(n) = Ω(g(n))? Give the definition and then explain what it means in your own terms. – 5 points 5. Show that , make sure you use the definition and justify the inequalities and constants used. - 4 points 6. Show that , make sure you use the definition and justify the inequalities and constants used. - 4 points 7. Show that , make sure you use the definition and justify the
  • 4. inequalities and constants used. - 4 points 8. Show that , make sure you use the definition and justify the inequalities and constants used. - 4 points 9. Show that , make sure you use the definition and justify the inequalities and constants used. - 4 points 10. What principle governs how you add/remove elements in a stack? Spell it out and briefly explain. - 4 points 11. Briefly describe an application of a stack. - 4 points
  • 5. 12. What principle governs how you add/remove elements in a queue? Spell it out and briefly explain. - 4 points 13. Briefly describe an application of a queue. - 4 points Consider the following graph (pseudocode for BFS and DFS given on page 9): 14. Write the order in which the nodes would be visited in when doing a breadth first search (BFS) traversal starting at node 4. Also, write the distances from 4 to every other node. - 6 points 15. Write the order in which the nodes would be visited in when doing a breadth first search (BFS) traversal starting at node 5. Also, write the distances from 5 to every other node. - 6 points
  • 6. Same graph (for your convenience): 16. Write the order in which the nodes would be visited in when doing a depth first search (DFS) traversal starting at node 4 (order discovered or order off the stack). - 6 points 17. Write the order in which the nodes would be visited in when doing a depth first search (DFS) traversal starting at node 5 (order discovered or order off the stack). - 6 points 18. Give the definition of a graph. - 5 points 19. Give the definition of a tree (from graph theory). - 4 points BFS Pseudocode (for graph with n vertices): Input: grapharray[n][n], source
  • 7. queue<int> Q int distance[n] (array to keep track of nodes distances (from source), all values set to -1 except source which is set to 0 i.e. - 1 = not visited) Q.push(source) while(Q is not empty) v = Q.front Q.pop() for each neighbor w of v if distance[w] = -1 print w distance[w] = distance[v]+1 Q.push(w) end if end for end while DFS Pseudocode (for graph with n vertices): Input: grapharray[n][n], source stack<int> S int visited[n] (array to keep track of nodes visited, all values set to 0 except source which is set to 1 i.e. 0 = not visited, 1 = visited) S.push(source) while(S is not empty)
  • 8. v = S.top S.pop() for each neighbor w of v if visited[w] = 0 print w visited[w] = 1 S.push(w) end if end for end while Bonus (4 points): Show all of the steps (splitting and merging) when using mergesort to sort (smallest to largest) the following array (they are the numbers 1 through 16): [16, 1, 15, 2, 14, 3, 13, 4, 12, 5, 11, 6, 10, 7, 9, 8]
  • 9. Bonus (2 points): describe how you could implement a queue using 2 stacks. Bonus (4 points) Draw the binary search tree that would be constructed by inserting the following values in the exact order given (starting with an empty tree i.e. first value will be the first node in the tree): - a. Binary Search Tree A: 8, 9, 2, 7, 1, 10, 3, 5, 6, 4
  • 10. b. Binary Search Tree B: 10, 7, 9, 12, 4, 2, 5, 3, 1, 14, 11, 19, 13, 18, 20 11