SlideShare a Scribd company logo
1 of 22
CS241 - Fall 2017 - Assignment #6
Assigned: November 21st, 2017
Due: November 30th, 2017
Collaboration policy: The goal of homework is to give you
practice in
mastering the course material. Consequently, you are
encouraged to collab-
orate with others (groups of at most three). In fact, students
who form
study groups generally do better on exams than do students who
work alone.
If you do work in a study group, however, you owe it to
yourself and your
group to be prepared for your study group meeting. Specifically,
you should
spend at least 30–45 minutes trying to solve each problem
beforehand. If
your group is unable to solve a problem, it is your responsibility
to get help
from the instructor before the assignment is due. You must
write up
each problem solution and/or code any programming assignment
by yourself without assistance, even if you collaborate with
others to solve
the problem. You are asked to identify your collaborators. If
you did
not work with anyone, you must write “Collaborators: none.” If
you obtain
a solution through research (e.g., on the web), acknowledge
your source, but
write up the solution in your own words. It is a violation of this
pol-
icy to submit a problem solution that you cannot orally explain
to the instructor. No other student may use your solutions; this
includes
your writing, code, tests, documentation, etc. It is a violation of
this policy
to permit anyone other than the instructor and yourself read-
access to the
location where you keep your solutions.
1
Submission Guidelines: Your group has to submit your work on
Black-
board by the due date. Only one submission per group is
necessary.
Just make sure that you identify your group in the header by
putting all names in the “author” field. For each of the program-
ming assignments you must use the header template provided in
Blackboard.
The header must contain, your name, course number, semester,
homework
number, problem number, and list of collaborators (if any,
otherwise put
“none”). Your answers to questions that do not require coding
must be in-
cluded in this header as well. Your code must follow the Java
formatting
standards posted in Blackboard. Format will also be part of your
grade.
To complete your submission, you have to upload two files to
Blackboard:
your source file and your class file. The submission will be
returned without
grading if any of these guidelines is not followed.
Style and Correctness: Keep in mind that your goal is to
communi-
cate. Full credit will be given only to the correct solution which
is described
clearly. Convoluted and obtuse descriptions might receive low
marks, even
when they are correct. Also, aim for concise solutions, as it will
save you
time spent on write-ups, and also help you conceptualize the
key idea of the
problem.
2
Assignment 6
Programming Assignment Grading Rubric:
The following rubric applies only to the programming
assignment.
Program
characteristic
Program feature
Credit
possible
Part 3
Design
30%
Algorithm 30%
Functionality
30%
Program runs
without errors
20%
Correct result given 10%
Input
15%
User friendly,
typos, spacing
10%
Values read in
correctly
5%
Output
15%
Output provided 10%
Proper spelling,
spacing, user friendly
5%
Format
10%
Documentation: name,
collaborators, header, etc.
5%
Clarity: comments,
indentation, etc.
5%
TOTAL 100%
1(20) 2(20) 3(40) 4(20) TOTAL(100)
3
Assignment:
The intended usage of a data structure is crucial to choose the
most
efficient one. Common operations include insertions/deletions,
queries1, and
range queries2. Suppose that the application requirements are
such that
the crucial operations are insertions and queries. We know that
hash tables
have O(1) query time, provided that the hash function
distributes the entries
uniformly. But also a good choice of the initial table size is
crucial to avoid
costly re-hashings when new entries are added. AVL trees are
Binary Search
Trees that balance themselves through rotations. Because they
are balanced,
the query time is O(log n). But the order in which the entries
are added is
also important to avoid the worst-case O(log n) rotations per
insertion. The
purpose of this homework is to test experimentally the insertion
and query
performance of a separate-chaining hash table and an AVL tree,
drawing
conclusions from the results observed.
Assuming that each entry is a pair <key,value>, where the key
is used
to index the entries, do the following.
1. (20 points) Make a conjecture for the asymptotic running
time of (a)
adding n entries with consecutive keys in a separate-chaining
hash
table and (b) searching for a key that is not in the table. Justify
your conjecture using the running times detailed above and any
other
assumptions you make.
2. (20 points) Make a conjecture for the asymptotic running
time of
(a) adding n entries with consecutive keys in an AVL tree and
(b)
searching for a key that is not in the tree. Justify your
conjecture
using the running times detailed above and any other
assumptions you
make.
3. (40 points) Write a program that does the following.
• Create an instance of the Hashtable class from the Java API.
Make the initial table size of the hash table 1000 and the load
factor3 0.75 (which has been shown experimentally to be
optimal).
1Access operations, such as read or contains.
2Returning multiple items.
3The load factor is the occupancy threshold for rehashing. That
is, if the number of
items in the table is more than the table size times the load
factor, the object rehashes
the table increasing the capacity.
4
• Create an instance of the AVLtree class attached with this
home-
work.
• Measure the running time of adding various numbers of entries
(as
required by the table below) to the hash table and the AVL tree.
• For each of those cases, measure the running time of searching
for
a key that is not in the hash table, and do the same for the AVL
tree.
Fill in the following charts, adjusting the values of n as needed
accord-
ing to your platform to obtain at least 4 measurements.
construction time n = 102 n = 103 n = 104 n = 105 n = 106
Hash table
Tree
search time n = 102 n = 103 n = 104 n = 105 n = 106
Hash table
Tree
4. (20 points) How does these measurements compare with your
con-
jecture in parts 1 and 2? If the results differ from your
conjecture,
investigate the reason by looking carefully at the code of
Hashtable
(grepcode.com) and AVLtree provided and explain what might
have
happened.
5
grepcode.com
CS241 - Fall 2017 - Assignment #4
Assigned: October 30th, 2017
Due: November 7th, 2017
Collaboration policy: The goal of homework is to give you
practice in
mastering the course material. Consequently, you are
encouraged to collab-
orate with others (groups of at most three). In fact, students
who form
study groups generally do better on exams than do students who
work alone.
If you do work in a study group, however, you owe it to
yourself and your
group to be prepared for your study group meeting. Specifically,
you should
spend at least 30–45 minutes trying to solve each problem
beforehand. If
your group is unable to solve a problem, it is your responsibility
to get help
from the instructor before the assignment is due. You must
write up
each problem solution and/or code any programming assignment
by yourself without assistance, even if you collaborate with
others to solve
the problem. You are asked to identify your collaborators. If
you did
not work with anyone, you must write “Collaborators: none.” If
you obtain
a solution through research (e.g., on the web), acknowledge
your source, but
write up the solution in your own words. It is a violation of this
pol-
icy to submit a problem solution that you cannot orally explain
to the instructor. No other student may use your solutions; this
includes
your writing, code, tests, documentation, etc. It is a violation of
this policy
to permit anyone other than the instructor and yourself read-
access to the
location where you keep your solutions.
1
Submission Guidelines: Your group has to submit your work on
Black-
board by the due date. Only one submission per group is
necessary.
Just make sure that you identify your group in the header by
putting all names in the “author” field. For each of the program-
ming assignments you must use the header template provided in
Blackboard.
The header must contain, your name, course number, semester,
homework
number, problem number, and list of collaborators (if any,
otherwise put
“none”). Your answers to questions that do not require coding
must be in-
cluded in this header as well. Your code must follow the Java
formatting
standards posted in Blackboard. Format will also be part of your
grade.
To complete your submission, you have to upload two files to
Blackboard:
your source file and your class file. The submission will be
returned without
grading if any of these guidelines is not followed.
Style and Correctness: Keep in mind that your goal is to
communi-
cate. Full credit will be given only to the correct solution which
is described
clearly. Convoluted and obtuse descriptions might receive low
marks, even
when they are correct. Also, aim for concise solutions, as it will
save you
time spent on write-ups, and also help you conceptualize the
key idea of the
problem.
2
Assignment 4
Programming Assignment Grading Rubric:
The following rubric applies only to the programming
assignment.
Program
characteristic
Program feature
Credit
possible
Part 2
Design
30%
Algorithm 30%
Functionality
30%
Program runs
without errors
20%
Correct result given 10%
Input
15%
User friendly,
typos, spacing
10%
Values read in
correctly
5%
Output
15%
Output provided 10%
Proper spelling,
spacing, user friendly
5%
Format
10%
Documentation: name,
collaborators, header, etc.
5%
Clarity: comments,
indentation, etc.
5%
TOTAL 100%
1(20) 2(60) 3(20) TOTAL(100)
3
Assignment:
The way that data is stored in a Binary Search Tree (BST)
depends
on the order in which the values are inserted. For example, if
we insert the
numbers 1, 2, 3 in that order, the resulting tree has 1 in the root,
2 as a
right child of the root, and 3 as a right child of 2. However, if
we insert
first 2, then 2 will be stored in the root, and 1 and 3 will be the
left and
right child of the root respectively. Moreover, not only the
values are stored
in different places but also the shape of the tree obtained is
different. The
first one is skewed whereas the second one is balanced. As a
consequence,
although both trees contain the same data, the worst-case cost of
searching
differs. The purpose of this homework is to highlight this
striking difference
in running time, creating a skewed BST and a (roughly)
balanced BST, both
with a large number of nodes, and measuring the execution time
of searching
on each.
1. (20 points) Estimate the asymptotic running time of searching
in a
skewed BST and a balanced BST. Justify your conjecture
explaining
which operations of the BinarySearchTree class (attached) you
would
use, and explain how do you obtain the overall running time
from the
running times of those operations. You can use asymptotic
notation
(big-O).
2. (60 points) Write a program to do the following.
• Input an integer x. (Should work with “big” numbers.)
• Create a completely-skewed BST S containing 1, 2, . . . , x.
• Create a BST R containing x integers without repetitions gen-
erated at random. (To minimize the risk of repetitions, you can
multiply the value returned by random() by a big number.)
Given
that the numbers are generated uniformly at random, the tree
will
likely be balanced.
• Measure the time to search in S for a number that is not in the
tree.
• Measure the time to search in R for a new random number.
• Display the time taken for each search.
4
Fill in a chart like the following with the times in nanoseconds
mea-
sured. You may need to adjust the values of n according to your
plat-
form. That is, if your program takes too long to complete, or if
you run
out of memory, etc., reduce the range of n as needed. Your chart
must
have enough cells filled to be able to answer the following
question.
n = 103 n = 104 n = 105 n = 106
Skewed BST
Balanced BST
3. (20 points) How the results obtained compare with your
conjecture? If
the results differ from your conjecture, investigate the reason by
looking
carefully at the code of the BinarySearchTree class, and explain
what
happened.
4. Extra credit: Carry out the same experiments on the Java API
class
TreeMap. Compare the measurements with the skewed tree and
random
tree. Argue why the running time functions observed are
(roughly)
equal/different .
5
CS241 - Fall 2017 - Assignment #5
Assigned: November 9th, 2017
Due: November 16th, 2017
Collaboration policy: The goal of homework is to give you
practice in
mastering the course material. Consequently, you are
encouraged to collab-
orate with others (groups of at most three). In fact, students
who form
study groups generally do better on exams than do students who
work alone.
If you do work in a study group, however, you owe it to
yourself and your
group to be prepared for your study group meeting. Specifically,
you should
spend at least 30–45 minutes trying to solve each problem
beforehand. If
your group is unable to solve a problem, it is your responsibility
to get help
from the instructor before the assignment is due. You must
write up
each problem solution and/or code any programming assignment
by yourself without assistance, even if you collaborate with
others to solve
the problem. You are asked to identify your collaborators. If
you did
not work with anyone, you must write “Collaborators: none.” If
you obtain
a solution through research (e.g., on the web), acknowledge
your source, but
write up the solution in your own words. It is a violation of this
pol-
icy to submit a problem solution that you cannot orally explain
to the instructor. No other student may use your solutions; this
includes
your writing, code, tests, documentation, etc. It is a violation of
this policy
to permit anyone other than the instructor and yourself read-
access to the
location where you keep your solutions.
1
Submission Guidelines: Your group has to submit your work on
Black-
board by the due date. Only one submission per group is
necessary.
Just make sure that you identify your group in the header by
putting all names in the “author” field. For each of the program-
ming assignments you must use the header template provided in
Blackboard.
The header must contain, your name, course number, semester,
homework
number, problem number, and list of collaborators (if any,
otherwise put
“none”). Your answers to questions that do not require coding
must be in-
cluded in this header as well. Your code must follow the Java
formatting
standards posted in Blackboard. Format will also be part of your
grade.
To complete your submission, you have to upload two files to
Blackboard:
your source file and your class file. The submission will be
returned without
grading if any of these guidelines is not followed.
Style and Correctness: Keep in mind that your goal is to
communi-
cate. Full credit will be given only to the correct solution which
is described
clearly. Convoluted and obtuse descriptions might receive low
marks, even
when they are correct. Also, aim for concise solutions, as it will
save you
time spent on write-ups, and also help you conceptualize the
key idea of the
problem.
2
Assignment 5
Programming Assignment Grading Rubric:
The following rubric applies only to the programming
assignment.
Program
characteristic
Program feature
Credit
possible
Design
30%
Algorithm 30%
Functionality
30%
Program runs
without errors
20%
Correct result given 10%
Input
15%
User friendly,
typos, spacing
10%
Values read in
correctly
5%
Output
15%
Output provided 10%
Proper spelling,
spacing, user friendly
5%
Format
10%
Documentation: name,
collaborators, header, etc.
5%
Clarity: comments,
indentation, etc.
5%
TOTAL 100%
1(20) 2(30) 3(30) 4(20) TOTAL(100)
3
Assignment:
Quick Sort is a popular sorting algorithm because it usually
achieves op-
timal O(n log n) running time in practice. However, in the worst
case, the
running time can be quadratic. The method to choose the pivot
is crucial to
avoid the worst cases. The purpose of this homework is to
evaluate exper-
imentally the performance of Quick Sort for different methods
of choosing
the pivot, and compare with Selection Sort, which is simpler but
quadratic.
1. (20 points) Write a method that implements Selection Sort.
2. (30 points) Write methods for two versions of Quick Sort,
depending
on how the pivot is chosen from each subarray to be sorted, as
follows.
(a) Choose the pivot from the first position of the subarray.
(b) Choose three positions of the subarray at random and make
the
median of the values in these positions the pivot.
3. (30 points) Write a test program that measures the running
time
of the above three methods while sorting 1000000 numbers
(adjust
the quantity if needed). Use three types of inputs: already sorted
in increasing order, already sorted in decreasing order, and an
input
with the numbers generated at random. Fill in the following
chart with
the running times observed.
version increasing order decreasing order random
1
2a
2b
4. (20 points) Draw conclusions from the values observed. Are
the mea-
surements significantly different for some cases? Why? How the
pivot
choice helps for those cases where the running time is smaller?
Extra Credit (up to 20%): Obtain real data of similar volume
(for
instance from the Internet) and test your methods. Provide
references
to the data source. How the running times observed compare
with the
running times observed on the synthesized data used in part 3?
Can
you draw conclusions from this comparison about the structure
of the
real data?
4

More Related Content

Similar to CS241 - Fall 2017 - Assignment #6Assigned November 21st, .docx

Cis 328Believe Possibilities / snaptutorial.com
Cis 328Believe Possibilities / snaptutorial.comCis 328Believe Possibilities / snaptutorial.com
Cis 328Believe Possibilities / snaptutorial.comStokesCope11
 
Cis 328 Education Specialist -snaptutorial.com
Cis 328   Education Specialist -snaptutorial.comCis 328   Education Specialist -snaptutorial.com
Cis 328 Education Specialist -snaptutorial.comDavisMurphyC36
 
cis 328 Education Organization - snaptutorial.com
cis 328  Education Organization - snaptutorial.comcis 328  Education Organization - snaptutorial.com
cis 328 Education Organization - snaptutorial.comdonaldzs180
 
Cis 328 Enhance teaching-snaptutorial.com
Cis 328 Enhance teaching-snaptutorial.comCis 328 Enhance teaching-snaptutorial.com
Cis 328 Enhance teaching-snaptutorial.comrobertleew8
 
Cis 328 Exceptional Education / snaptutorial.com
Cis 328   Exceptional Education / snaptutorial.comCis 328   Exceptional Education / snaptutorial.com
Cis 328 Exceptional Education / snaptutorial.comBaileya45
 
pa5PA5.docxCS 211 PA #5At certain universities, professors of.docx
pa5PA5.docxCS 211 PA #5At certain universities, professors of.docxpa5PA5.docxCS 211 PA #5At certain universities, professors of.docx
pa5PA5.docxCS 211 PA #5At certain universities, professors of.docxgerardkortney
 
Test case design_the_basicsv0.4
Test case design_the_basicsv0.4Test case design_the_basicsv0.4
Test case design_the_basicsv0.4guest31fced
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxDrYogeshDeshmukh1
 
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docxDIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docxlynettearnold46882
 
CSCI 180 Project Grading  Your project is graded based .docx
CSCI 180 Project Grading   Your project is graded based .docxCSCI 180 Project Grading   Your project is graded based .docx
CSCI 180 Project Grading  Your project is graded based .docxfaithxdunce63732
 
CS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docx
CS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docxCS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docx
CS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docxannettsparrow
 
Chapter 1 IntroductionIntroductionIn this section, present.docx
Chapter 1 IntroductionIntroductionIn this section, present.docxChapter 1 IntroductionIntroductionIn this section, present.docx
Chapter 1 IntroductionIntroductionIn this section, present.docxketurahhazelhurst
 
MKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docx
MKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docxMKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docx
MKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docxBrandy Wang
 

Similar to CS241 - Fall 2017 - Assignment #6Assigned November 21st, .docx (13)

Cis 328Believe Possibilities / snaptutorial.com
Cis 328Believe Possibilities / snaptutorial.comCis 328Believe Possibilities / snaptutorial.com
Cis 328Believe Possibilities / snaptutorial.com
 
Cis 328 Education Specialist -snaptutorial.com
Cis 328   Education Specialist -snaptutorial.comCis 328   Education Specialist -snaptutorial.com
Cis 328 Education Specialist -snaptutorial.com
 
cis 328 Education Organization - snaptutorial.com
cis 328  Education Organization - snaptutorial.comcis 328  Education Organization - snaptutorial.com
cis 328 Education Organization - snaptutorial.com
 
Cis 328 Enhance teaching-snaptutorial.com
Cis 328 Enhance teaching-snaptutorial.comCis 328 Enhance teaching-snaptutorial.com
Cis 328 Enhance teaching-snaptutorial.com
 
Cis 328 Exceptional Education / snaptutorial.com
Cis 328   Exceptional Education / snaptutorial.comCis 328   Exceptional Education / snaptutorial.com
Cis 328 Exceptional Education / snaptutorial.com
 
pa5PA5.docxCS 211 PA #5At certain universities, professors of.docx
pa5PA5.docxCS 211 PA #5At certain universities, professors of.docxpa5PA5.docxCS 211 PA #5At certain universities, professors of.docx
pa5PA5.docxCS 211 PA #5At certain universities, professors of.docx
 
Test case design_the_basicsv0.4
Test case design_the_basicsv0.4Test case design_the_basicsv0.4
Test case design_the_basicsv0.4
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptx
 
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docxDIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
 
CSCI 180 Project Grading  Your project is graded based .docx
CSCI 180 Project Grading   Your project is graded based .docxCSCI 180 Project Grading   Your project is graded based .docx
CSCI 180 Project Grading  Your project is graded based .docx
 
CS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docx
CS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docxCS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docx
CS 111 - Homework 5 p. 1CS 111 - Homework 5Deadline1.docx
 
Chapter 1 IntroductionIntroductionIn this section, present.docx
Chapter 1 IntroductionIntroductionIn this section, present.docxChapter 1 IntroductionIntroductionIn this section, present.docx
Chapter 1 IntroductionIntroductionIn this section, present.docx
 
MKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docx
MKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docxMKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docx
MKTG 317 Syllabus WANG Summer International Marketing 2023.7.15.docx
 

More from annettsparrow

Initial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docxInitial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docxannettsparrow
 
initial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docxinitial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docxannettsparrow
 
Initial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docxInitial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docxannettsparrow
 
Initial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docxInitial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docxannettsparrow
 
Initial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docxInitial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docxannettsparrow
 
Initial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docxInitial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docxannettsparrow
 
Initial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docxInitial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docxannettsparrow
 
Initial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docxInitial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docxannettsparrow
 
Initial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docxInitial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docxannettsparrow
 
Initial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docxInitial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docxannettsparrow
 
Initial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docxInitial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docxannettsparrow
 
Infrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docxInfrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docxannettsparrow
 
Inital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docxInital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docxannettsparrow
 
Infornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docxInfornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docxannettsparrow
 
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docxINFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docxannettsparrow
 
INFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docxINFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docxannettsparrow
 
Informative Presentation Delivery OutlineI. HeaderSpeec.docx
Informative Presentation Delivery OutlineI.  HeaderSpeec.docxInformative Presentation Delivery OutlineI.  HeaderSpeec.docx
Informative Presentation Delivery OutlineI. HeaderSpeec.docxannettsparrow
 
Informed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docxInformed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docxannettsparrow
 
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docxINFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docxannettsparrow
 
Information Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docxInformation Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docxannettsparrow
 

More from annettsparrow (20)

Initial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docxInitial Post  (250 words)Read and interpret the short story .docx
Initial Post  (250 words)Read and interpret the short story .docx
 
initial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docxinitial post one paragraph intext citation and reference Require.docx
initial post one paragraph intext citation and reference Require.docx
 
Initial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docxInitial Post InstructionsTriggers are ethnocentric responses to .docx
Initial Post InstructionsTriggers are ethnocentric responses to .docx
 
Initial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docxInitial Post InstructionsFor the initial post,consider thr.docx
Initial Post InstructionsFor the initial post,consider thr.docx
 
Initial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docxInitial Post InstructionsFor the initial post, choose and ad.docx
Initial Post InstructionsFor the initial post, choose and ad.docx
 
Initial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docxInitial Post InstructionsDiscuss the differences and similaritie.docx
Initial Post InstructionsDiscuss the differences and similaritie.docx
 
Initial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docxInitial Post InstructionsAs we jump into the world of Alge.docx
Initial Post InstructionsAs we jump into the world of Alge.docx
 
Initial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docxInitial Post InstructionsFor the initial post, respond to one .docx
Initial Post InstructionsFor the initial post, respond to one .docx
 
Initial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docxInitial Post InstructionsAgenda setting can be a difficult t.docx
Initial Post InstructionsAgenda setting can be a difficult t.docx
 
Initial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docxInitial Post Identify all the components of a cell. Describe the fu.docx
Initial Post Identify all the components of a cell. Describe the fu.docx
 
Initial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docxInitial Discussion Board Post Compare and contrast life for col.docx
Initial Discussion Board Post Compare and contrast life for col.docx
 
Infrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docxInfrastructure SecurityChapter 10Principles of Compute.docx
Infrastructure SecurityChapter 10Principles of Compute.docx
 
Inital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docxInital post please respond for the above post question one page with.docx
Inital post please respond for the above post question one page with.docx
 
Infornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docxInfornnation Technologyin Hunnan ResourceAnEmpirical .docx
Infornnation Technologyin Hunnan ResourceAnEmpirical .docx
 
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docxINFORMED CONSENT LETTER  Page 1 of 2 SELF CONSENT .docx
INFORMED CONSENT LETTER Page 1 of 2 SELF CONSENT .docx
 
INFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docxINFORMATIONGOVERNANCEFounded in 1807, John W.docx
INFORMATIONGOVERNANCEFounded in 1807, John W.docx
 
Informative Presentation Delivery OutlineI. HeaderSpeec.docx
Informative Presentation Delivery OutlineI.  HeaderSpeec.docxInformative Presentation Delivery OutlineI.  HeaderSpeec.docx
Informative Presentation Delivery OutlineI. HeaderSpeec.docx
 
Informed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docxInformed Consent FormBy the due date assigned, submit the Inform.docx
Informed Consent FormBy the due date assigned, submit the Inform.docx
 
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docxINFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
INFORMATION THAT SHOULD GO INTO PROCESS RECORDING FOR MICRO WORK.docx
 
Information Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docxInformation Technology Capstone ProjectIn this course, learners .docx
Information Technology Capstone ProjectIn this course, learners .docx
 

Recently uploaded

Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff17thcssbs2
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17Celine George
 
Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeSaadHumayun7
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...Nguyen Thanh Tu Collection
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointELaRue0
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxCeline George
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Celine George
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTechSoup
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryEugene Lysak
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticspragatimahajan3
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17Celine George
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Celine George
 
The Ultimate Guide to Social Media Marketing in 2024.pdf
The Ultimate Guide to Social Media Marketing in 2024.pdfThe Ultimate Guide to Social Media Marketing in 2024.pdf
The Ultimate Guide to Social Media Marketing in 2024.pdfdm4ashexcelr
 

Recently uploaded (20)

Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff
 
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdfPost Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tube
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPoint
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
The Ultimate Guide to Social Media Marketing in 2024.pdf
The Ultimate Guide to Social Media Marketing in 2024.pdfThe Ultimate Guide to Social Media Marketing in 2024.pdf
The Ultimate Guide to Social Media Marketing in 2024.pdf
 

CS241 - Fall 2017 - Assignment #6Assigned November 21st, .docx

  • 1. CS241 - Fall 2017 - Assignment #6 Assigned: November 21st, 2017 Due: November 30th, 2017 Collaboration policy: The goal of homework is to give you practice in mastering the course material. Consequently, you are encouraged to collab- orate with others (groups of at most three). In fact, students who form study groups generally do better on exams than do students who work alone. If you do work in a study group, however, you owe it to yourself and your group to be prepared for your study group meeting. Specifically, you should spend at least 30–45 minutes trying to solve each problem beforehand. If your group is unable to solve a problem, it is your responsibility to get help from the instructor before the assignment is due. You must write up each problem solution and/or code any programming assignment by yourself without assistance, even if you collaborate with others to solve the problem. You are asked to identify your collaborators. If you did not work with anyone, you must write “Collaborators: none.” If you obtain a solution through research (e.g., on the web), acknowledge your source, but
  • 2. write up the solution in your own words. It is a violation of this pol- icy to submit a problem solution that you cannot orally explain to the instructor. No other student may use your solutions; this includes your writing, code, tests, documentation, etc. It is a violation of this policy to permit anyone other than the instructor and yourself read- access to the location where you keep your solutions. 1 Submission Guidelines: Your group has to submit your work on Black- board by the due date. Only one submission per group is necessary. Just make sure that you identify your group in the header by putting all names in the “author” field. For each of the program- ming assignments you must use the header template provided in Blackboard. The header must contain, your name, course number, semester, homework number, problem number, and list of collaborators (if any, otherwise put “none”). Your answers to questions that do not require coding must be in- cluded in this header as well. Your code must follow the Java formatting standards posted in Blackboard. Format will also be part of your grade. To complete your submission, you have to upload two files to Blackboard: your source file and your class file. The submission will be
  • 3. returned without grading if any of these guidelines is not followed. Style and Correctness: Keep in mind that your goal is to communi- cate. Full credit will be given only to the correct solution which is described clearly. Convoluted and obtuse descriptions might receive low marks, even when they are correct. Also, aim for concise solutions, as it will save you time spent on write-ups, and also help you conceptualize the key idea of the problem. 2 Assignment 6 Programming Assignment Grading Rubric: The following rubric applies only to the programming assignment. Program characteristic Program feature Credit possible Part 3 Design 30%
  • 4. Algorithm 30% Functionality 30% Program runs without errors 20% Correct result given 10% Input 15% User friendly, typos, spacing 10% Values read in correctly 5% Output 15% Output provided 10% Proper spelling, spacing, user friendly 5%
  • 5. Format 10% Documentation: name, collaborators, header, etc. 5% Clarity: comments, indentation, etc. 5% TOTAL 100% 1(20) 2(20) 3(40) 4(20) TOTAL(100) 3 Assignment: The intended usage of a data structure is crucial to choose the most efficient one. Common operations include insertions/deletions, queries1, and range queries2. Suppose that the application requirements are such that the crucial operations are insertions and queries. We know that hash tables have O(1) query time, provided that the hash function distributes the entries uniformly. But also a good choice of the initial table size is crucial to avoid costly re-hashings when new entries are added. AVL trees are
  • 6. Binary Search Trees that balance themselves through rotations. Because they are balanced, the query time is O(log n). But the order in which the entries are added is also important to avoid the worst-case O(log n) rotations per insertion. The purpose of this homework is to test experimentally the insertion and query performance of a separate-chaining hash table and an AVL tree, drawing conclusions from the results observed. Assuming that each entry is a pair <key,value>, where the key is used to index the entries, do the following. 1. (20 points) Make a conjecture for the asymptotic running time of (a) adding n entries with consecutive keys in a separate-chaining hash table and (b) searching for a key that is not in the table. Justify your conjecture using the running times detailed above and any other assumptions you make. 2. (20 points) Make a conjecture for the asymptotic running time of (a) adding n entries with consecutive keys in an AVL tree and (b) searching for a key that is not in the tree. Justify your conjecture using the running times detailed above and any other assumptions you make.
  • 7. 3. (40 points) Write a program that does the following. • Create an instance of the Hashtable class from the Java API. Make the initial table size of the hash table 1000 and the load factor3 0.75 (which has been shown experimentally to be optimal). 1Access operations, such as read or contains. 2Returning multiple items. 3The load factor is the occupancy threshold for rehashing. That is, if the number of items in the table is more than the table size times the load factor, the object rehashes the table increasing the capacity. 4 • Create an instance of the AVLtree class attached with this home- work. • Measure the running time of adding various numbers of entries (as required by the table below) to the hash table and the AVL tree. • For each of those cases, measure the running time of searching for a key that is not in the hash table, and do the same for the AVL tree. Fill in the following charts, adjusting the values of n as needed accord- ing to your platform to obtain at least 4 measurements.
  • 8. construction time n = 102 n = 103 n = 104 n = 105 n = 106 Hash table Tree search time n = 102 n = 103 n = 104 n = 105 n = 106 Hash table Tree 4. (20 points) How does these measurements compare with your con- jecture in parts 1 and 2? If the results differ from your conjecture, investigate the reason by looking carefully at the code of Hashtable (grepcode.com) and AVLtree provided and explain what might have happened. 5 grepcode.com CS241 - Fall 2017 - Assignment #4 Assigned: October 30th, 2017 Due: November 7th, 2017 Collaboration policy: The goal of homework is to give you practice in mastering the course material. Consequently, you are encouraged to collab-
  • 9. orate with others (groups of at most three). In fact, students who form study groups generally do better on exams than do students who work alone. If you do work in a study group, however, you owe it to yourself and your group to be prepared for your study group meeting. Specifically, you should spend at least 30–45 minutes trying to solve each problem beforehand. If your group is unable to solve a problem, it is your responsibility to get help from the instructor before the assignment is due. You must write up each problem solution and/or code any programming assignment by yourself without assistance, even if you collaborate with others to solve the problem. You are asked to identify your collaborators. If you did not work with anyone, you must write “Collaborators: none.” If you obtain a solution through research (e.g., on the web), acknowledge your source, but write up the solution in your own words. It is a violation of this pol- icy to submit a problem solution that you cannot orally explain to the instructor. No other student may use your solutions; this includes your writing, code, tests, documentation, etc. It is a violation of this policy to permit anyone other than the instructor and yourself read- access to the location where you keep your solutions. 1
  • 10. Submission Guidelines: Your group has to submit your work on Black- board by the due date. Only one submission per group is necessary. Just make sure that you identify your group in the header by putting all names in the “author” field. For each of the program- ming assignments you must use the header template provided in Blackboard. The header must contain, your name, course number, semester, homework number, problem number, and list of collaborators (if any, otherwise put “none”). Your answers to questions that do not require coding must be in- cluded in this header as well. Your code must follow the Java formatting standards posted in Blackboard. Format will also be part of your grade. To complete your submission, you have to upload two files to Blackboard: your source file and your class file. The submission will be returned without grading if any of these guidelines is not followed. Style and Correctness: Keep in mind that your goal is to communi- cate. Full credit will be given only to the correct solution which is described clearly. Convoluted and obtuse descriptions might receive low marks, even when they are correct. Also, aim for concise solutions, as it will save you time spent on write-ups, and also help you conceptualize the key idea of the
  • 11. problem. 2 Assignment 4 Programming Assignment Grading Rubric: The following rubric applies only to the programming assignment. Program characteristic Program feature Credit possible Part 2 Design 30% Algorithm 30% Functionality 30% Program runs without errors 20% Correct result given 10%
  • 12. Input 15% User friendly, typos, spacing 10% Values read in correctly 5% Output 15% Output provided 10% Proper spelling, spacing, user friendly 5% Format 10% Documentation: name, collaborators, header, etc. 5% Clarity: comments, indentation, etc. 5%
  • 13. TOTAL 100% 1(20) 2(60) 3(20) TOTAL(100) 3 Assignment: The way that data is stored in a Binary Search Tree (BST) depends on the order in which the values are inserted. For example, if we insert the numbers 1, 2, 3 in that order, the resulting tree has 1 in the root, 2 as a right child of the root, and 3 as a right child of 2. However, if we insert first 2, then 2 will be stored in the root, and 1 and 3 will be the left and right child of the root respectively. Moreover, not only the values are stored in different places but also the shape of the tree obtained is different. The first one is skewed whereas the second one is balanced. As a consequence, although both trees contain the same data, the worst-case cost of searching differs. The purpose of this homework is to highlight this striking difference in running time, creating a skewed BST and a (roughly) balanced BST, both with a large number of nodes, and measuring the execution time of searching on each.
  • 14. 1. (20 points) Estimate the asymptotic running time of searching in a skewed BST and a balanced BST. Justify your conjecture explaining which operations of the BinarySearchTree class (attached) you would use, and explain how do you obtain the overall running time from the running times of those operations. You can use asymptotic notation (big-O). 2. (60 points) Write a program to do the following. • Input an integer x. (Should work with “big” numbers.) • Create a completely-skewed BST S containing 1, 2, . . . , x. • Create a BST R containing x integers without repetitions gen- erated at random. (To minimize the risk of repetitions, you can multiply the value returned by random() by a big number.) Given that the numbers are generated uniformly at random, the tree will likely be balanced. • Measure the time to search in S for a number that is not in the tree. • Measure the time to search in R for a new random number. • Display the time taken for each search. 4 Fill in a chart like the following with the times in nanoseconds
  • 15. mea- sured. You may need to adjust the values of n according to your plat- form. That is, if your program takes too long to complete, or if you run out of memory, etc., reduce the range of n as needed. Your chart must have enough cells filled to be able to answer the following question. n = 103 n = 104 n = 105 n = 106 Skewed BST Balanced BST 3. (20 points) How the results obtained compare with your conjecture? If the results differ from your conjecture, investigate the reason by looking carefully at the code of the BinarySearchTree class, and explain what happened. 4. Extra credit: Carry out the same experiments on the Java API class TreeMap. Compare the measurements with the skewed tree and random tree. Argue why the running time functions observed are (roughly) equal/different . 5
  • 16. CS241 - Fall 2017 - Assignment #5 Assigned: November 9th, 2017 Due: November 16th, 2017 Collaboration policy: The goal of homework is to give you practice in mastering the course material. Consequently, you are encouraged to collab- orate with others (groups of at most three). In fact, students who form study groups generally do better on exams than do students who work alone. If you do work in a study group, however, you owe it to yourself and your group to be prepared for your study group meeting. Specifically, you should spend at least 30–45 minutes trying to solve each problem beforehand. If your group is unable to solve a problem, it is your responsibility to get help from the instructor before the assignment is due. You must write up each problem solution and/or code any programming assignment by yourself without assistance, even if you collaborate with others to solve the problem. You are asked to identify your collaborators. If you did not work with anyone, you must write “Collaborators: none.” If you obtain a solution through research (e.g., on the web), acknowledge your source, but write up the solution in your own words. It is a violation of this pol- icy to submit a problem solution that you cannot orally explain to the instructor. No other student may use your solutions; this
  • 17. includes your writing, code, tests, documentation, etc. It is a violation of this policy to permit anyone other than the instructor and yourself read- access to the location where you keep your solutions. 1 Submission Guidelines: Your group has to submit your work on Black- board by the due date. Only one submission per group is necessary. Just make sure that you identify your group in the header by putting all names in the “author” field. For each of the program- ming assignments you must use the header template provided in Blackboard. The header must contain, your name, course number, semester, homework number, problem number, and list of collaborators (if any, otherwise put “none”). Your answers to questions that do not require coding must be in- cluded in this header as well. Your code must follow the Java formatting standards posted in Blackboard. Format will also be part of your grade. To complete your submission, you have to upload two files to Blackboard: your source file and your class file. The submission will be returned without grading if any of these guidelines is not followed. Style and Correctness: Keep in mind that your goal is to
  • 18. communi- cate. Full credit will be given only to the correct solution which is described clearly. Convoluted and obtuse descriptions might receive low marks, even when they are correct. Also, aim for concise solutions, as it will save you time spent on write-ups, and also help you conceptualize the key idea of the problem. 2 Assignment 5 Programming Assignment Grading Rubric: The following rubric applies only to the programming assignment. Program characteristic Program feature Credit possible Design 30% Algorithm 30% Functionality 30%
  • 19. Program runs without errors 20% Correct result given 10% Input 15% User friendly, typos, spacing 10% Values read in correctly 5% Output 15% Output provided 10% Proper spelling, spacing, user friendly 5% Format 10% Documentation: name, collaborators, header, etc.
  • 20. 5% Clarity: comments, indentation, etc. 5% TOTAL 100% 1(20) 2(30) 3(30) 4(20) TOTAL(100) 3 Assignment: Quick Sort is a popular sorting algorithm because it usually achieves op- timal O(n log n) running time in practice. However, in the worst case, the running time can be quadratic. The method to choose the pivot is crucial to avoid the worst cases. The purpose of this homework is to evaluate exper- imentally the performance of Quick Sort for different methods of choosing the pivot, and compare with Selection Sort, which is simpler but quadratic. 1. (20 points) Write a method that implements Selection Sort. 2. (30 points) Write methods for two versions of Quick Sort, depending on how the pivot is chosen from each subarray to be sorted, as follows.
  • 21. (a) Choose the pivot from the first position of the subarray. (b) Choose three positions of the subarray at random and make the median of the values in these positions the pivot. 3. (30 points) Write a test program that measures the running time of the above three methods while sorting 1000000 numbers (adjust the quantity if needed). Use three types of inputs: already sorted in increasing order, already sorted in decreasing order, and an input with the numbers generated at random. Fill in the following chart with the running times observed. version increasing order decreasing order random 1 2a 2b 4. (20 points) Draw conclusions from the values observed. Are the mea- surements significantly different for some cases? Why? How the pivot choice helps for those cases where the running time is smaller? Extra Credit (up to 20%): Obtain real data of similar volume (for instance from the Internet) and test your methods. Provide references to the data source. How the running times observed compare with the running times observed on the synthesized data used in part 3?
  • 22. Can you draw conclusions from this comparison about the structure of the real data? 4