SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
Array Buffers with and Without Duplicates
This assignment assumes you have a mastered assignment the BufferArray class in Assignment 1
had
methods for insert, find, remove, stableRemove, and display, as well as a private helper function
called locationOf. Change the remove function as fastRemove
In this assignment, we will create two variants of the BufferArray class; BufferArrayNoDups and
BufferArrayWithDups as children classes of the BufferArray class. As the name implies, the first
class
does not allow the insertion of duplicate values, while the second one does. The
BufferArrayNoDups
class should look like the BufferArray class in Assignment 1. Only the insert operation has to
change.
Both remove functions should assume that there is never more than one copy of a value. For this
assignment I would also like the distinction between the two remove functions to be more clear. So
please rename the remove as fastRemove and leave the other one with the same name
stableRemove.
The BufferArrayWithDups class should also look like the class in BufferArray class in Assignment
1. This
time, do not change the insert function, and implement both remove functions as for the NoDups
case.
But, in addition, add three new methods, called findAll, fastRemoveAll, and stableRemoveAll. The
findAll function should return an int with the number of elements that have the same value as the
target
value, while the two removeAll functions should remove all copies of the target value. Have both
removeAll functions return an int with the number of values that were actually removed. For this
assignment, we will make two more changes. First, omit the BUFFER_SZ constant, and instead
have the
constructor take an integer argument for the size.

Weitere ähnliche Inhalte

Ähnlich wie Array Buffers with and Without Duplicates This assignment as.pdf

Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
lykado0dles
 
Inheritance And Traits
Inheritance And TraitsInheritance And Traits
Inheritance And Traits
Piyush Mishra
 
Packages namespace instance
Packages namespace instancePackages namespace instance
Packages namespace instance
Chenglin Lee
 
Reusable Ruby • Rt 9 Ruby Group • Jun 2012
Reusable Ruby • Rt 9 Ruby Group • Jun 2012Reusable Ruby • Rt 9 Ruby Group • Jun 2012
Reusable Ruby • Rt 9 Ruby Group • Jun 2012
skinandbones
 

Ähnlich wie Array Buffers with and Without Duplicates This assignment as.pdf (20)

Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
 
25 java interview questions
25 java interview questions25 java interview questions
25 java interview questions
 
Package in Java
Package in JavaPackage in Java
Package in Java
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
Java interview questions 2
Java interview questions 2Java interview questions 2
Java interview questions 2
 
Ruby object model - Understanding of object play role for ruby
Ruby object model - Understanding of object play role for rubyRuby object model - Understanding of object play role for ruby
Ruby object model - Understanding of object play role for ruby
 
Packages,static,this keyword in java
Packages,static,this keyword in javaPackages,static,this keyword in java
Packages,static,this keyword in java
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
 
Package In Java
Package In JavaPackage In Java
Package In Java
 
Inheritance And Traits
Inheritance And TraitsInheritance And Traits
Inheritance And Traits
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
Test Presentation
Test PresentationTest Presentation
Test Presentation
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
Packages namespace instance
Packages namespace instancePackages namespace instance
Packages namespace instance
 
Reusable Ruby • Rt 9 Ruby Group • Jun 2012
Reusable Ruby • Rt 9 Ruby Group • Jun 2012Reusable Ruby • Rt 9 Ruby Group • Jun 2012
Reusable Ruby • Rt 9 Ruby Group • Jun 2012
 
encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloading
 
Java Core Parctical
Java Core ParcticalJava Core Parctical
Java Core Parctical
 
java tr.docx
java tr.docxjava tr.docx
java tr.docx
 

Mehr von ADITYAMOBILEGALLRY

Apple Inc en 2020 Despus de casi una dcada como CEO Tim.pdf
Apple Inc en 2020  Despus de casi una dcada como CEO Tim.pdfApple Inc en 2020  Despus de casi una dcada como CEO Tim.pdf
Apple Inc en 2020 Despus de casi una dcada como CEO Tim.pdf
ADITYAMOBILEGALLRY
 
artculo 10 En el caso a continuacin se proporciona el ma.pdf
artculo 10  En el caso a continuacin se proporciona el ma.pdfartculo 10  En el caso a continuacin se proporciona el ma.pdf
artculo 10 En el caso a continuacin se proporciona el ma.pdf
ADITYAMOBILEGALLRY
 

Mehr von ADITYAMOBILEGALLRY (20)

As part of an analysis of gut microbiome variation Dutch res.pdf
As part of an analysis of gut microbiome variation Dutch res.pdfAs part of an analysis of gut microbiome variation Dutch res.pdf
As part of an analysis of gut microbiome variation Dutch res.pdf
 
As young entrepreneurs there are various mechanisms and chal.pdf
As young entrepreneurs there are various mechanisms and chal.pdfAs young entrepreneurs there are various mechanisms and chal.pdf
As young entrepreneurs there are various mechanisms and chal.pdf
 
As the molecular cloud starts to collapse intro a future sta.pdf
As the molecular cloud starts to collapse intro a future sta.pdfAs the molecular cloud starts to collapse intro a future sta.pdf
As the molecular cloud starts to collapse intro a future sta.pdf
 
As presented in the units learning resources logical opera.pdf
As presented in the units learning resources logical opera.pdfAs presented in the units learning resources logical opera.pdf
As presented in the units learning resources logical opera.pdf
 
As the concentration of CO2 in the water decreases the pH o.pdf
As the concentration of CO2 in the water decreases the pH o.pdfAs the concentration of CO2 in the water decreases the pH o.pdf
As the concentration of CO2 in the water decreases the pH o.pdf
 
As part of an environmental risk assessment scientists and .pdf
As part of an environmental risk assessment scientists and .pdfAs part of an environmental risk assessment scientists and .pdf
As part of an environmental risk assessment scientists and .pdf
 
As of December 31 Year 1 Valley Company has 11500 cash i.pdf
As of December 31 Year 1 Valley Company has 11500 cash i.pdfAs of December 31 Year 1 Valley Company has 11500 cash i.pdf
As of December 31 Year 1 Valley Company has 11500 cash i.pdf
 
As an HIM professional you have been asked to take part in .pdf
As an HIM professional you have been asked to take part in .pdfAs an HIM professional you have been asked to take part in .pdf
As an HIM professional you have been asked to take part in .pdf
 
Aos de edad Nmero de visitantes sesenta y cinco 1 66 .pdf
Aos de edad  Nmero de visitantes  sesenta y cinco  1  66 .pdfAos de edad  Nmero de visitantes  sesenta y cinco  1  66 .pdf
Aos de edad Nmero de visitantes sesenta y cinco 1 66 .pdf
 
Appendix 6B Inventory Costing Methods Periodic Average C.pdf
Appendix 6B  Inventory Costing Methods Periodic Average C.pdfAppendix 6B  Inventory Costing Methods Periodic Average C.pdf
Appendix 6B Inventory Costing Methods Periodic Average C.pdf
 
APC es un supresor de tumores y acta en la va de sealizac.pdf
APC es un supresor de tumores y acta en la va de sealizac.pdfAPC es un supresor de tumores y acta en la va de sealizac.pdf
APC es un supresor de tumores y acta en la va de sealizac.pdf
 
Apply your knowledge learned about the architecture that fac.pdf
Apply your knowledge learned about the architecture that fac.pdfApply your knowledge learned about the architecture that fac.pdf
Apply your knowledge learned about the architecture that fac.pdf
 
Apply strategies identified to create a digital presentation.pdf
Apply strategies identified to create a digital presentation.pdfApply strategies identified to create a digital presentation.pdf
Apply strategies identified to create a digital presentation.pdf
 
Application of the TripleHelixModel in South Africa with h.pdf
Application of the TripleHelixModel in South Africa with h.pdfApplication of the TripleHelixModel in South Africa with h.pdf
Application of the TripleHelixModel in South Africa with h.pdf
 
APPLEnin Ortam Analizi Applen dahili kaynaklar yetenek.pdf
APPLEnin  Ortam Analizi  Applen dahili kaynaklar yetenek.pdfAPPLEnin  Ortam Analizi  Applen dahili kaynaklar yetenek.pdf
APPLEnin Ortam Analizi Applen dahili kaynaklar yetenek.pdf
 
Apple Inc en 2020 Despus de casi una dcada como CEO Tim.pdf
Apple Inc en 2020  Despus de casi una dcada como CEO Tim.pdfApple Inc en 2020  Despus de casi una dcada como CEO Tim.pdf
Apple Inc en 2020 Despus de casi una dcada como CEO Tim.pdf
 
Aruba Cloud is a CSP domiciled in Italy offering Disaster Re.pdf
Aruba Cloud is a CSP domiciled in Italy offering Disaster Re.pdfAruba Cloud is a CSP domiciled in Italy offering Disaster Re.pdf
Aruba Cloud is a CSP domiciled in Italy offering Disaster Re.pdf
 
As a final year Information Technology student of a Universi.pdf
As a final year Information Technology student of a Universi.pdfAs a final year Information Technology student of a Universi.pdf
As a final year Information Technology student of a Universi.pdf
 
As a final year Information Technology student of Ghana Comm.pdf
As a final year Information Technology student of Ghana Comm.pdfAs a final year Information Technology student of Ghana Comm.pdf
As a final year Information Technology student of Ghana Comm.pdf
 
artculo 10 En el caso a continuacin se proporciona el ma.pdf
artculo 10  En el caso a continuacin se proporciona el ma.pdfartculo 10  En el caso a continuacin se proporciona el ma.pdf
artculo 10 En el caso a continuacin se proporciona el ma.pdf
 

Kürzlich hochgeladen

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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
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
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Array Buffers with and Without Duplicates This assignment as.pdf

  • 1. Array Buffers with and Without Duplicates This assignment assumes you have a mastered assignment the BufferArray class in Assignment 1 had methods for insert, find, remove, stableRemove, and display, as well as a private helper function called locationOf. Change the remove function as fastRemove In this assignment, we will create two variants of the BufferArray class; BufferArrayNoDups and BufferArrayWithDups as children classes of the BufferArray class. As the name implies, the first class does not allow the insertion of duplicate values, while the second one does. The BufferArrayNoDups class should look like the BufferArray class in Assignment 1. Only the insert operation has to change. Both remove functions should assume that there is never more than one copy of a value. For this assignment I would also like the distinction between the two remove functions to be more clear. So please rename the remove as fastRemove and leave the other one with the same name stableRemove. The BufferArrayWithDups class should also look like the class in BufferArray class in Assignment 1. This time, do not change the insert function, and implement both remove functions as for the NoDups case. But, in addition, add three new methods, called findAll, fastRemoveAll, and stableRemoveAll. The findAll function should return an int with the number of elements that have the same value as the target value, while the two removeAll functions should remove all copies of the target value. Have both removeAll functions return an int with the number of values that were actually removed. For this assignment, we will make two more changes. First, omit the BUFFER_SZ constant, and instead have the constructor take an integer argument for the size.