SlideShare a Scribd company logo
1 of 13
User_42751212015Module1and2pagestocompetework.pdf
User_42751212015Module1and2pagestocompetework_1.pdf
User_42751212015Module2Homework(CIS330).docx
[INSERT TITLE HERE] 1
Running head: [INSERT TITLE HERE]
[INSERT TITLE HERE]
Student Name
Allied American University
Author Note
This paper was prepared for [INSERT COURSE NAME],
[INSERT COURSE ASSIGNMENT] taught by [INSERT
INSTRUCTOR’S NAME].
Directions: Please complete each of the following exercises.
Please read the instructions carefully.
For all “short programming assignments,” include source code
files in your submission.
1. Short programming assignment. Combine the malloc2D
function of program 3.16 with the adjacency matrix code of
program 3.18 to write a program that allows the user to first
enter the count of vertices, and then enter the graph edges. The
program should then output the graph with lines of the form:
There is an edge between 0 and 3.
2. Short programming assignment. Modify your program for
question 2.1 so that after the adjacency matrix is created, it is
then converted to an adjacency list, and the output is generated
from the list.
3. Short programming assignment. Modify program 4.7 from
the text, overloading the == operator to work for this ADT
using a friend function.
4. Is the ADT given in program 4.7 a first-class ADT?
Explain your answer.
5. Suppose you are given the source code for a C++ class,
and asked if the class shown is an ADT. On what factors would
your decision be based?
6. How does using strings instead of simple types like
integers alter the O-notation of operations?
User_42751212015Module1Homework(CIS330)Corrected
(1).docx
[INSERT TITLE HERE] 1
Running head: [INSERT TITLE HERE]
[INSERT TITLE HERE]
Student Name
Allied American University
Author Note
This paper was prepared for [INSERT COURSE NAME],
[INSERT COURSE ASSIGNMENT] taught by [INSERT
INSTRUCTOR’S NAME].
Directions: Please refer to your textbook to complete the
following exercises.1. Refer to page 12 of your text to respond
to the following:Show the contents of the id array after each
union operation when you use the quick find algorithm
(Program I.I) to solve the connectivity problem for the sequence
0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3. Also give the number of
times the program accesses the id array for each input pair.2.
Refer to page 12 of your text to respond to the following:Show
the contents of the id array after each union operation when you
use the quick union algorithm (Program I.I) to solve the
connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6-
0, and 1-3. Also give the number of times the program accesses
the id array for each input pair.3. Refer to figures 1.7 and 1.8
on pages 16 and 17 of the text. Give the contents of the id array
after each union operation for the weighted quick union
algorithm running on the examples corresponding to figures 1.7
and 1.84. For what value is N is 10N lg N>2N2?
5. Prove that O(1) is the same as O(2)
6. You are given the information that the time complexity of
one problem is N log N and that the time complexity of another
problem is N3. What does this statement imply about the
relative performance of specific algorithms that solve the
problems?
User_42751212015Module1Homework(CIS330).docx
1
Running head: [INSERT TITLE HERE]
Introduction to Algorithm Analysis
Candice R. James
Allied American University
Author Note
This paper was prepared for Algorithm Design and
Analysis, Module One Homework, taught by Biswajit Panja.
Directions: Please complete each of the following exercises.
Please read the instructions carefully.
For all “short programming assignments,” include source code
files in your submission.
1. The following questions refer to the connectivity problem.
a. Explain the difference between the quick-find algorithm
and the quick-union algorithm.
Quick find :is an algorithm that places emphasis on finding out
if two nodes are connected or not.
We can use a typical array to represent a set of nodes and their
connections to each other.
{1,2,3,4,5};
Indexes of the array are the nodes and the values of the array
are the connections. When the value of one index equals that of
another node’s value, then the two nodes are connected.
Quick Find approach has a very fast method to check
connectivity. To check the connectivity, you just need to access
the array twice. However, union is extremely slow. Since
whenever you do union, you have to go through all the array,
you will end up with O(N) runtime.
The quick find has 3 methods. They are:
constructor: prepares the set as an array
connected: checks if two nodes are connected or not
union: connects two nodes
Quick Union:
Quick union improves greatly in union operation. Instead of
going through entire array during union, you attach one node’s
root to another’s root.
b. How can maintaining the “weight” of each subtree improve
the quick-union algorithm?
During a union operation, the data structure correctly adjusts
the size of the root of the merged trees. Therefore, after any
union operation, all the tree roots have the correct sizes.
While you are correct that during path compression in the find
step that the sizes aren't updated, there is no reason that the data
structure would change sizes here. Path compression just
reduces the length of the paths from nodes in some tree up to
the root of the tree. It doesn't change the number of nodes
stored in that tree. Accordingly, the size information at the root
of the tree undergoing path compression does not need to
change. Although some internal subtrees might lose some
children as they are reparented higher up in the tree, this is
irrelevant because the union/find structure only needs to
maintain size information at the roots of its trees, not at internal
nodes.
Overall, this means that the data structure does correctly store
size information. There is no adverse impact on runtime, nor is
there a need to correct anything.
c. What is path compression and why is it useful?
Generally heuristics by rank and path compression are used to
achieve fast disjoint-set data structure operations. Somehow, I
find heuristics by weight and path compression more sensible
2. For each of the following connectivity problem data sets,
explain whether it describes actual, random, or perverse data.
a. The data is the list 0-1, 1-2, 2-3, 3-4, ..., 99-100.
Data in the above set is perverse.
Because list contains values that are floating point numbers.
So we cannot predict the actual value.
b. The data is generated by rolling a hundred-sided die.
Data in the above set is random.
We get a number in range(1-100)
Because every number in the set has same probability to occur.
c. The data is an encoding of links in a country’s railway
system.
Data in the above set is Actual because exact value can be
encoded by using some mechanism or algorithm
3. The following refer to O-notation.
a. Suppose f(n) = n2 + 10n + 5. Explain what is meant when
we say f(n) is O(n2).
Big O notation describes the limiting behavior of a function
when the argument tends towards a particular value or infinity,
usually in terms of simpler functions. It is a member of a larger
family of notations that is called Landau notation, Bachmann–
Landau notation (after Edmund Landau and Paul
Bachmann),[1][2] or asymptotic notation. In computer science,
big O notation is used to classify algorithms[3][4] by how they
respond (e.g., in their processing time or working space
requirements) to changes in input size. In analytic number
theory, it is used to estimate the "error committed" while
replacing the asymptotic size, or asymptotic mean size, of an
arithmetical function, by the value, or mean value, it takes at a
large finite argument. A famous example is the problem of
estimating the remainder term in the prime number theorem.
Big O notation characterizes functions according to their growth
rates: different functions with the same growth rate may be
represented using the same O notation. The letter O is used
because the growth rate of a function is also referred to as order
of the function. A description of a function in terms of big O
notation usually only provides an upper bound on the growth
rate of the function. Associated with big O notation are several
related notations, using the symbols o, ?, ?, and ?, to describe
other kinds of bounds on asymptotic growth rates.
b. What is an asymptotic expression?
an asymptotic expansion, asymptotic series or Poincaré
expansion (after Henri Poincaré) is a formal series of functions
which has the property that truncating the series after a finite
number of terms provides an approximation to a given function
as the argument of the function tends towards a particular, often
infinite, point.
The most common type of asymptotic expansion is a power
series in either positive or negative powers. Methods of
generating such expansions include the Euler–Maclaurin
summation formula and integral transforms such as the Laplace
and Mellin transforms. Repeated integration by parts will often
lead to an asymptotic expansion.
Since a convergent Taylor series fits the definition of
asymptotic expansion as well, the phrase "asymptotic series"
usually implies a non-convergent series. Despite non-
convergence, the asymptotic expansion is useful when truncated
to a finite number of terms. Typically, the best approximation is
given when the series is truncated at the smallest term. This
way of optimally truncating an asymptotic expansion is known
as superasymptotics.[1] The error is then typically of the form
where ? is the expansion parameter. The error is thus beyond all
orders in the expansion parameter. It is possible to improve on
the superasymptotic error, e.g. by employing resummation
methods such as Borel resummation to the divergent tail. Such
methods are often referred to as hyperasymptotic
approximations
4. Solve the recurrence
CN = CN/2 + N, C1 = 0
when N is a power of 2.
C2 = -2C1 / 3
C_n+3 = [ C_n – (n+2)(n+5)*C_n+2 ] / [ 3(n+2)(n+3) ]
For the first independent solution, let C0 = 0.
For the second, let C1 = 0.
We get
y1 = C0 * [ 1 + 1/18 * x^3 – 1/36 * x^4 + 7/540 * x^5 + … ]
y2 = C1 * [x – 2/3 * x^2 + 10/27 * x^3 – 17/108 * x^4 +
101/1620 * x^5 + …
5. Consider a sales record book with 1000 pages, one for each
customer, in no particular order. Below are algorithms for
looking up a customer’s record in the book. For each algorithm,
describe the best case, the average case, and the worst case.
a. Start from the first page and work towards the back.
best case: the record to be looked up appears in the very first
page of the record book.(eg page 1)
average case: the record to be looked up appears somewhere in
the middle of the record book.(eg between 400-600)
worst case: the record to be looked up appears on the last page
of the record book.(eg 1000th page)
b. Use dice to generate a number from 1 to 1000, look on that
page; repeat as needed.
best case: the record to be looked up is represented by the very
first throw of the dice.
average case: the record to be looked up is represented by the
dice after a few throws.
worst case: the record to be looked up is never ever represented
by the dice or represented after several hundred throws.
User_42751212015Module2Homework(CIS330).docx
[INSERT TITLE HERE] 1
Running head: [INSERT TITLE HERE]
[INSERT TITLE HERE]
Student Name
Allied American University
Author Note
This paper was prepared for [INSERT COURSE NAME],
[INSERT COURSE ASSIGNMENT] taught by [INSERT
INSTRUCTOR’S NAME].
Directions: Please complete each of the following exercises.
Please read the instructions carefully.
For all “short programming assignments,” include source code
files in your submission.
1. Short programming assignment. Combine the malloc2D
function of program 3.16 with the adjacency matrix code of
program 3.18 to write a program that allows the user to first
enter the count of vertices, and then enter the graph edges. The
program should then output the graph with lines of the form:
There is an edge between 0 and 3.
2. Short programming assignment. Modify your program for
question 2.1 so that after the adjacency matrix is created, it is
then converted to an adjacency list, and the output is generated
from the list.
3. Short programming assignment. Modify program 4.7 from
the text, overloading the == operator to work for this ADT
using a friend function.
4. Is the ADT given in program 4.7 a first-class ADT?
Explain your answer.
5. Suppose you are given the source code for a C++ class,
and asked if the class shown is an ADT. On what factors would
your decision be based?
6. How does using strings instead of simple types like
integers alter the O-notation of operations?
User_42751212015Module1Homework(CIS330)Corrected
(1).docx
[INSERT TITLE HERE] 1
Running head: [INSERT TITLE HERE]
[INSERT TITLE HERE]
Student Name
Allied American University
Author Note
This paper was prepared for [INSERT COURSE NAME],
[INSERT COURSE ASSIGNMENT] taught by [INSERT
INSTRUCTOR’S NAME].
Directions: Please refer to your textbook to complete the
following exercises.1. Refer to page 12 of your text to respond
to the following:Show the contents of the id array after each
union operation when you use the quick find algorithm
(Program I.I) to solve the connectivity problem for the sequence
0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3. Also give the number of
times the program accesses the id array for each input pair.2.
Refer to page 12 of your text to respond to the following:Show
the contents of the id array after each union operation when you
use the quick union algorithm (Program I.I) to solve the
connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6-
0, and 1-3. Also give the number of times the program accesses
the id array for each input pair.3. Refer to figures 1.7 and 1.8
on pages 16 and 17 of the text. Give the contents of the id array
after each union operation for the weighted quick union
algorithm running on the examples corresponding to figures 1.7
and 1.84. For what value is N is 10N lg N>2N2?
5. Prove that O(1) is the same as O(2)
6. You are given the information that the time complexity of
one problem is N log N and that the time complexity of another
problem is N3. What does this statement imply about the
relative performance of specific algorithms that solve the
problems?

More Related Content

Similar to User_42751212015Module1and2pagestocompetework.pdf.docx

Application's of Numerical Math in CSE
Application's of Numerical Math in CSEApplication's of Numerical Math in CSE
Application's of Numerical Math in CSEsanjana mun
 
Problems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor SystemProblems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor Systemijtsrd
 
Algorithm & data structure lec2
Algorithm & data structure lec2Algorithm & data structure lec2
Algorithm & data structure lec2Abdul Khan
 
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...IRJET Journal
 
Performance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsPerformance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsDinusha Dilanka
 
Feed forward neural network for sine
Feed forward neural network for sineFeed forward neural network for sine
Feed forward neural network for sineijcsa
 
5 parallel implementation 06299286
5 parallel implementation 062992865 parallel implementation 06299286
5 parallel implementation 06299286Ninad Samel
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm AnalysisMary Margarat
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfkarymadelaneyrenne19
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptracha49
 
Introduction to Design Algorithm And Analysis.ppt
Introduction to Design Algorithm And Analysis.pptIntroduction to Design Algorithm And Analysis.ppt
Introduction to Design Algorithm And Analysis.pptBhargaviDalal4
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxskilljiolms
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureRai University
 

Similar to User_42751212015Module1and2pagestocompetework.pdf.docx (20)

Application's of Numerical Math in CSE
Application's of Numerical Math in CSEApplication's of Numerical Math in CSE
Application's of Numerical Math in CSE
 
Problems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor SystemProblems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor System
 
Bigdata analytics
Bigdata analyticsBigdata analytics
Bigdata analytics
 
Algorithm & data structure lec2
Algorithm & data structure lec2Algorithm & data structure lec2
Algorithm & data structure lec2
 
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
A Novel Design For Generating Dynamic Length Message Digest To Ensure Integri...
 
Performance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsPerformance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning Algorithms
 
Feed forward neural network for sine
Feed forward neural network for sineFeed forward neural network for sine
Feed forward neural network for sine
 
5 parallel implementation 06299286
5 parallel implementation 062992865 parallel implementation 06299286
5 parallel implementation 06299286
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
N ns 1
N ns 1N ns 1
N ns 1
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
 
Introduction to Design Algorithm And Analysis.ppt
Introduction to Design Algorithm And Analysis.pptIntroduction to Design Algorithm And Analysis.ppt
Introduction to Design Algorithm And Analysis.ppt
 
Lect1.pptx
Lect1.pptxLect1.pptx
Lect1.pptx
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structure
 

More from dickonsondorris

Copyright © eContent Management Pty Ltd. Health Sociology Revi.docx
Copyright © eContent Management Pty Ltd. Health Sociology Revi.docxCopyright © eContent Management Pty Ltd. Health Sociology Revi.docx
Copyright © eContent Management Pty Ltd. Health Sociology Revi.docxdickonsondorris
 
Copyright © Pearson Education 2010 Digital Tools in Toda.docx
Copyright © Pearson Education 2010 Digital Tools in Toda.docxCopyright © Pearson Education 2010 Digital Tools in Toda.docx
Copyright © Pearson Education 2010 Digital Tools in Toda.docxdickonsondorris
 
Copyright © Jen-Wen Lin 2018 1 STA457 Time series .docx
Copyright © Jen-Wen Lin 2018   1 STA457 Time series .docxCopyright © Jen-Wen Lin 2018   1 STA457 Time series .docx
Copyright © Jen-Wen Lin 2018 1 STA457 Time series .docxdickonsondorris
 
Copyright © John Wiley & Sons, Inc. All rights reserved..docx
Copyright © John Wiley & Sons, Inc. All rights reserved..docxCopyright © John Wiley & Sons, Inc. All rights reserved..docx
Copyright © John Wiley & Sons, Inc. All rights reserved..docxdickonsondorris
 
Copyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docx
Copyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docxCopyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docx
Copyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docxdickonsondorris
 
Copyright © Cengage Learning. All rights reserved. CHAPTE.docx
Copyright © Cengage Learning.  All rights reserved. CHAPTE.docxCopyright © Cengage Learning.  All rights reserved. CHAPTE.docx
Copyright © Cengage Learning. All rights reserved. CHAPTE.docxdickonsondorris
 
Copyright © by Holt, Rinehart and Winston. All rights reserved.docx
Copyright © by Holt, Rinehart and Winston. All rights reserved.docxCopyright © by Holt, Rinehart and Winston. All rights reserved.docx
Copyright © by Holt, Rinehart and Winston. All rights reserved.docxdickonsondorris
 
Copyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docx
Copyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docxCopyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docx
Copyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docxdickonsondorris
 
Copyright © 2019, American Institute of Certified Public Accou.docx
Copyright © 2019, American Institute of Certified Public Accou.docxCopyright © 2019, American Institute of Certified Public Accou.docx
Copyright © 2019, American Institute of Certified Public Accou.docxdickonsondorris
 
Copyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docx
Copyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docxCopyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docx
Copyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docxdickonsondorris
 
Copyright © 2018 Pearson Education, Inc. C H A P T E R 6.docx
Copyright © 2018 Pearson Education, Inc. C H A P T E R  6.docxCopyright © 2018 Pearson Education, Inc. C H A P T E R  6.docx
Copyright © 2018 Pearson Education, Inc. C H A P T E R 6.docxdickonsondorris
 
Copyright © 2018 Capella University. Copy and distribution o.docx
Copyright © 2018 Capella University. Copy and distribution o.docxCopyright © 2018 Capella University. Copy and distribution o.docx
Copyright © 2018 Capella University. Copy and distribution o.docxdickonsondorris
 
Copyright © 2018 Pearson Education, Inc.C H A P T E R 3.docx
Copyright © 2018 Pearson Education, Inc.C H A P T E R  3.docxCopyright © 2018 Pearson Education, Inc.C H A P T E R  3.docx
Copyright © 2018 Pearson Education, Inc.C H A P T E R 3.docxdickonsondorris
 
Copyright © 2018 by Steven Levitsky and Daniel.docx
Copyright © 2018 by Steven Levitsky and Daniel.docxCopyright © 2018 by Steven Levitsky and Daniel.docx
Copyright © 2018 by Steven Levitsky and Daniel.docxdickonsondorris
 
Copyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docx
Copyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docxCopyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docx
Copyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docxdickonsondorris
 
Copyright © 2017 Wolters Kluwer Health Lippincott Williams.docx
Copyright © 2017 Wolters Kluwer Health  Lippincott Williams.docxCopyright © 2017 Wolters Kluwer Health  Lippincott Williams.docx
Copyright © 2017 Wolters Kluwer Health Lippincott Williams.docxdickonsondorris
 
Copyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docx
Copyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docxCopyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docx
Copyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docxdickonsondorris
 
Copyright © 2017 by University of Phoenix. All rights rese.docx
Copyright © 2017 by University of Phoenix. All rights rese.docxCopyright © 2017 by University of Phoenix. All rights rese.docx
Copyright © 2017 by University of Phoenix. All rights rese.docxdickonsondorris
 
Copyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docx
Copyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docxCopyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docx
Copyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docxdickonsondorris
 
Copyright © 2016 Pearson Education, Inc. .docx
Copyright © 2016 Pearson Education, Inc.                    .docxCopyright © 2016 Pearson Education, Inc.                    .docx
Copyright © 2016 Pearson Education, Inc. .docxdickonsondorris
 

More from dickonsondorris (20)

Copyright © eContent Management Pty Ltd. Health Sociology Revi.docx
Copyright © eContent Management Pty Ltd. Health Sociology Revi.docxCopyright © eContent Management Pty Ltd. Health Sociology Revi.docx
Copyright © eContent Management Pty Ltd. Health Sociology Revi.docx
 
Copyright © Pearson Education 2010 Digital Tools in Toda.docx
Copyright © Pearson Education 2010 Digital Tools in Toda.docxCopyright © Pearson Education 2010 Digital Tools in Toda.docx
Copyright © Pearson Education 2010 Digital Tools in Toda.docx
 
Copyright © Jen-Wen Lin 2018 1 STA457 Time series .docx
Copyright © Jen-Wen Lin 2018   1 STA457 Time series .docxCopyright © Jen-Wen Lin 2018   1 STA457 Time series .docx
Copyright © Jen-Wen Lin 2018 1 STA457 Time series .docx
 
Copyright © John Wiley & Sons, Inc. All rights reserved..docx
Copyright © John Wiley & Sons, Inc. All rights reserved..docxCopyright © John Wiley & Sons, Inc. All rights reserved..docx
Copyright © John Wiley & Sons, Inc. All rights reserved..docx
 
Copyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docx
Copyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docxCopyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docx
Copyright © by The McGraw-Hill Companies, Inc. The Aztec Accou.docx
 
Copyright © Cengage Learning. All rights reserved. CHAPTE.docx
Copyright © Cengage Learning.  All rights reserved. CHAPTE.docxCopyright © Cengage Learning.  All rights reserved. CHAPTE.docx
Copyright © Cengage Learning. All rights reserved. CHAPTE.docx
 
Copyright © by Holt, Rinehart and Winston. All rights reserved.docx
Copyright © by Holt, Rinehart and Winston. All rights reserved.docxCopyright © by Holt, Rinehart and Winston. All rights reserved.docx
Copyright © by Holt, Rinehart and Winston. All rights reserved.docx
 
Copyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docx
Copyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docxCopyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docx
Copyright © 2020 by Jones & Bartlett Learning, LLC, an Ascend .docx
 
Copyright © 2019, American Institute of Certified Public Accou.docx
Copyright © 2019, American Institute of Certified Public Accou.docxCopyright © 2019, American Institute of Certified Public Accou.docx
Copyright © 2019, American Institute of Certified Public Accou.docx
 
Copyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docx
Copyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docxCopyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docx
Copyright © 2018 Pearson Education, Inc. All Rights ReservedChild .docx
 
Copyright © 2018 Pearson Education, Inc. C H A P T E R 6.docx
Copyright © 2018 Pearson Education, Inc. C H A P T E R  6.docxCopyright © 2018 Pearson Education, Inc. C H A P T E R  6.docx
Copyright © 2018 Pearson Education, Inc. C H A P T E R 6.docx
 
Copyright © 2018 Capella University. Copy and distribution o.docx
Copyright © 2018 Capella University. Copy and distribution o.docxCopyright © 2018 Capella University. Copy and distribution o.docx
Copyright © 2018 Capella University. Copy and distribution o.docx
 
Copyright © 2018 Pearson Education, Inc.C H A P T E R 3.docx
Copyright © 2018 Pearson Education, Inc.C H A P T E R  3.docxCopyright © 2018 Pearson Education, Inc.C H A P T E R  3.docx
Copyright © 2018 Pearson Education, Inc.C H A P T E R 3.docx
 
Copyright © 2018 by Steven Levitsky and Daniel.docx
Copyright © 2018 by Steven Levitsky and Daniel.docxCopyright © 2018 by Steven Levitsky and Daniel.docx
Copyright © 2018 by Steven Levitsky and Daniel.docx
 
Copyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docx
Copyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docxCopyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docx
Copyright © 2017, 2014, 2011 Pearson Education, Inc. All Right.docx
 
Copyright © 2017 Wolters Kluwer Health Lippincott Williams.docx
Copyright © 2017 Wolters Kluwer Health  Lippincott Williams.docxCopyright © 2017 Wolters Kluwer Health  Lippincott Williams.docx
Copyright © 2017 Wolters Kluwer Health Lippincott Williams.docx
 
Copyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docx
Copyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docxCopyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docx
Copyright © 2016, 2013, 2010 Pearson Education, Inc. All Right.docx
 
Copyright © 2017 by University of Phoenix. All rights rese.docx
Copyright © 2017 by University of Phoenix. All rights rese.docxCopyright © 2017 by University of Phoenix. All rights rese.docx
Copyright © 2017 by University of Phoenix. All rights rese.docx
 
Copyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docx
Copyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docxCopyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docx
Copyright © 2016 John Wiley & Sons, Inc.Copyright © 20.docx
 
Copyright © 2016 Pearson Education, Inc. .docx
Copyright © 2016 Pearson Education, Inc.                    .docxCopyright © 2016 Pearson Education, Inc.                    .docx
Copyright © 2016 Pearson Education, Inc. .docx
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 

User_42751212015Module1and2pagestocompetework.pdf.docx

  • 2. [INSERT TITLE HERE] Student Name Allied American University Author Note This paper was prepared for [INSERT COURSE NAME], [INSERT COURSE ASSIGNMENT] taught by [INSERT INSTRUCTOR’S NAME]. Directions: Please complete each of the following exercises. Please read the instructions carefully. For all “short programming assignments,” include source code files in your submission. 1. Short programming assignment. Combine the malloc2D function of program 3.16 with the adjacency matrix code of program 3.18 to write a program that allows the user to first enter the count of vertices, and then enter the graph edges. The program should then output the graph with lines of the form: There is an edge between 0 and 3.
  • 3. 2. Short programming assignment. Modify your program for question 2.1 so that after the adjacency matrix is created, it is then converted to an adjacency list, and the output is generated from the list. 3. Short programming assignment. Modify program 4.7 from the text, overloading the == operator to work for this ADT using a friend function. 4. Is the ADT given in program 4.7 a first-class ADT? Explain your answer. 5. Suppose you are given the source code for a C++ class, and asked if the class shown is an ADT. On what factors would your decision be based? 6. How does using strings instead of simple types like integers alter the O-notation of operations? User_42751212015Module1Homework(CIS330)Corrected (1).docx [INSERT TITLE HERE] 1 Running head: [INSERT TITLE HERE] [INSERT TITLE HERE] Student Name Allied American University
  • 4. Author Note This paper was prepared for [INSERT COURSE NAME], [INSERT COURSE ASSIGNMENT] taught by [INSERT INSTRUCTOR’S NAME]. Directions: Please refer to your textbook to complete the following exercises.1. Refer to page 12 of your text to respond to the following:Show the contents of the id array after each union operation when you use the quick find algorithm (Program I.I) to solve the connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3. Also give the number of times the program accesses the id array for each input pair.2. Refer to page 12 of your text to respond to the following:Show the contents of the id array after each union operation when you use the quick union algorithm (Program I.I) to solve the connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6- 0, and 1-3. Also give the number of times the program accesses the id array for each input pair.3. Refer to figures 1.7 and 1.8 on pages 16 and 17 of the text. Give the contents of the id array after each union operation for the weighted quick union algorithm running on the examples corresponding to figures 1.7 and 1.84. For what value is N is 10N lg N>2N2? 5. Prove that O(1) is the same as O(2) 6. You are given the information that the time complexity of one problem is N log N and that the time complexity of another problem is N3. What does this statement imply about the relative performance of specific algorithms that solve the problems?
  • 5. User_42751212015Module1Homework(CIS330).docx 1 Running head: [INSERT TITLE HERE] Introduction to Algorithm Analysis Candice R. James Allied American University Author Note This paper was prepared for Algorithm Design and Analysis, Module One Homework, taught by Biswajit Panja. Directions: Please complete each of the following exercises. Please read the instructions carefully. For all “short programming assignments,” include source code files in your submission. 1. The following questions refer to the connectivity problem. a. Explain the difference between the quick-find algorithm and the quick-union algorithm. Quick find :is an algorithm that places emphasis on finding out if two nodes are connected or not.
  • 6. We can use a typical array to represent a set of nodes and their connections to each other. {1,2,3,4,5}; Indexes of the array are the nodes and the values of the array are the connections. When the value of one index equals that of another node’s value, then the two nodes are connected. Quick Find approach has a very fast method to check connectivity. To check the connectivity, you just need to access the array twice. However, union is extremely slow. Since whenever you do union, you have to go through all the array, you will end up with O(N) runtime. The quick find has 3 methods. They are: constructor: prepares the set as an array connected: checks if two nodes are connected or not union: connects two nodes Quick Union: Quick union improves greatly in union operation. Instead of going through entire array during union, you attach one node’s root to another’s root. b. How can maintaining the “weight” of each subtree improve the quick-union algorithm? During a union operation, the data structure correctly adjusts the size of the root of the merged trees. Therefore, after any union operation, all the tree roots have the correct sizes. While you are correct that during path compression in the find step that the sizes aren't updated, there is no reason that the data structure would change sizes here. Path compression just reduces the length of the paths from nodes in some tree up to the root of the tree. It doesn't change the number of nodes stored in that tree. Accordingly, the size information at the root of the tree undergoing path compression does not need to change. Although some internal subtrees might lose some children as they are reparented higher up in the tree, this is irrelevant because the union/find structure only needs to
  • 7. maintain size information at the roots of its trees, not at internal nodes. Overall, this means that the data structure does correctly store size information. There is no adverse impact on runtime, nor is there a need to correct anything. c. What is path compression and why is it useful? Generally heuristics by rank and path compression are used to achieve fast disjoint-set data structure operations. Somehow, I find heuristics by weight and path compression more sensible 2. For each of the following connectivity problem data sets, explain whether it describes actual, random, or perverse data. a. The data is the list 0-1, 1-2, 2-3, 3-4, ..., 99-100. Data in the above set is perverse. Because list contains values that are floating point numbers. So we cannot predict the actual value. b. The data is generated by rolling a hundred-sided die. Data in the above set is random. We get a number in range(1-100) Because every number in the set has same probability to occur. c. The data is an encoding of links in a country’s railway system. Data in the above set is Actual because exact value can be encoded by using some mechanism or algorithm 3. The following refer to O-notation. a. Suppose f(n) = n2 + 10n + 5. Explain what is meant when we say f(n) is O(n2). Big O notation describes the limiting behavior of a function when the argument tends towards a particular value or infinity, usually in terms of simpler functions. It is a member of a larger family of notations that is called Landau notation, Bachmann– Landau notation (after Edmund Landau and Paul Bachmann),[1][2] or asymptotic notation. In computer science, big O notation is used to classify algorithms[3][4] by how they
  • 8. respond (e.g., in their processing time or working space requirements) to changes in input size. In analytic number theory, it is used to estimate the "error committed" while replacing the asymptotic size, or asymptotic mean size, of an arithmetical function, by the value, or mean value, it takes at a large finite argument. A famous example is the problem of estimating the remainder term in the prime number theorem. Big O notation characterizes functions according to their growth rates: different functions with the same growth rate may be represented using the same O notation. The letter O is used because the growth rate of a function is also referred to as order of the function. A description of a function in terms of big O notation usually only provides an upper bound on the growth rate of the function. Associated with big O notation are several related notations, using the symbols o, ?, ?, and ?, to describe other kinds of bounds on asymptotic growth rates. b. What is an asymptotic expression? an asymptotic expansion, asymptotic series or Poincaré expansion (after Henri Poincaré) is a formal series of functions which has the property that truncating the series after a finite number of terms provides an approximation to a given function as the argument of the function tends towards a particular, often infinite, point. The most common type of asymptotic expansion is a power series in either positive or negative powers. Methods of generating such expansions include the Euler–Maclaurin summation formula and integral transforms such as the Laplace and Mellin transforms. Repeated integration by parts will often lead to an asymptotic expansion. Since a convergent Taylor series fits the definition of asymptotic expansion as well, the phrase "asymptotic series" usually implies a non-convergent series. Despite non- convergence, the asymptotic expansion is useful when truncated to a finite number of terms. Typically, the best approximation is given when the series is truncated at the smallest term. This
  • 9. way of optimally truncating an asymptotic expansion is known as superasymptotics.[1] The error is then typically of the form where ? is the expansion parameter. The error is thus beyond all orders in the expansion parameter. It is possible to improve on the superasymptotic error, e.g. by employing resummation methods such as Borel resummation to the divergent tail. Such methods are often referred to as hyperasymptotic approximations 4. Solve the recurrence CN = CN/2 + N, C1 = 0 when N is a power of 2. C2 = -2C1 / 3 C_n+3 = [ C_n – (n+2)(n+5)*C_n+2 ] / [ 3(n+2)(n+3) ] For the first independent solution, let C0 = 0. For the second, let C1 = 0. We get y1 = C0 * [ 1 + 1/18 * x^3 – 1/36 * x^4 + 7/540 * x^5 + … ] y2 = C1 * [x – 2/3 * x^2 + 10/27 * x^3 – 17/108 * x^4 + 101/1620 * x^5 + … 5. Consider a sales record book with 1000 pages, one for each customer, in no particular order. Below are algorithms for looking up a customer’s record in the book. For each algorithm, describe the best case, the average case, and the worst case. a. Start from the first page and work towards the back. best case: the record to be looked up appears in the very first page of the record book.(eg page 1) average case: the record to be looked up appears somewhere in the middle of the record book.(eg between 400-600) worst case: the record to be looked up appears on the last page of the record book.(eg 1000th page) b. Use dice to generate a number from 1 to 1000, look on that page; repeat as needed. best case: the record to be looked up is represented by the very
  • 10. first throw of the dice. average case: the record to be looked up is represented by the dice after a few throws. worst case: the record to be looked up is never ever represented by the dice or represented after several hundred throws. User_42751212015Module2Homework(CIS330).docx [INSERT TITLE HERE] 1 Running head: [INSERT TITLE HERE] [INSERT TITLE HERE] Student Name Allied American University Author Note This paper was prepared for [INSERT COURSE NAME], [INSERT COURSE ASSIGNMENT] taught by [INSERT INSTRUCTOR’S NAME]. Directions: Please complete each of the following exercises. Please read the instructions carefully.
  • 11. For all “short programming assignments,” include source code files in your submission. 1. Short programming assignment. Combine the malloc2D function of program 3.16 with the adjacency matrix code of program 3.18 to write a program that allows the user to first enter the count of vertices, and then enter the graph edges. The program should then output the graph with lines of the form: There is an edge between 0 and 3. 2. Short programming assignment. Modify your program for question 2.1 so that after the adjacency matrix is created, it is then converted to an adjacency list, and the output is generated from the list. 3. Short programming assignment. Modify program 4.7 from the text, overloading the == operator to work for this ADT using a friend function. 4. Is the ADT given in program 4.7 a first-class ADT? Explain your answer. 5. Suppose you are given the source code for a C++ class, and asked if the class shown is an ADT. On what factors would your decision be based? 6. How does using strings instead of simple types like integers alter the O-notation of operations? User_42751212015Module1Homework(CIS330)Corrected (1).docx [INSERT TITLE HERE] 1 Running head: [INSERT TITLE HERE]
  • 12. [INSERT TITLE HERE] Student Name Allied American University Author Note This paper was prepared for [INSERT COURSE NAME], [INSERT COURSE ASSIGNMENT] taught by [INSERT INSTRUCTOR’S NAME]. Directions: Please refer to your textbook to complete the following exercises.1. Refer to page 12 of your text to respond to the following:Show the contents of the id array after each union operation when you use the quick find algorithm (Program I.I) to solve the connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3. Also give the number of times the program accesses the id array for each input pair.2. Refer to page 12 of your text to respond to the following:Show the contents of the id array after each union operation when you use the quick union algorithm (Program I.I) to solve the connectivity problem for the sequence 0-2, 1-4, 2-5, 3-6, 0-4, 6- 0, and 1-3. Also give the number of times the program accesses the id array for each input pair.3. Refer to figures 1.7 and 1.8
  • 13. on pages 16 and 17 of the text. Give the contents of the id array after each union operation for the weighted quick union algorithm running on the examples corresponding to figures 1.7 and 1.84. For what value is N is 10N lg N>2N2? 5. Prove that O(1) is the same as O(2) 6. You are given the information that the time complexity of one problem is N log N and that the time complexity of another problem is N3. What does this statement imply about the relative performance of specific algorithms that solve the problems?