SlideShare a Scribd company logo
1 of 35
ECET 370 Entire Course
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 1 Lab 1
ECET 370 Week 2 Lab 2
ECET 370 Week 3 Lab 3 Linked Lists
ECET 370 Week 4 Lab 4 Complexity of Computational Problems
ECET 370 Week 5 Lab 5 Search Algorithms and Techniques
ECET 370 Week 7 Lab 7 Binary Trees
------------------------------
ECET 370 Week 1 iLab Array Based Implementations (New
Syllabus)
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 1 iLab Array-Based Implementations
iLAB OVERVIEW
Scenario and Summary
The purpose of the iLab exercises is to help the student acquire skills in
developing programs that require implementation with arrays of abstract
data types, such as lists and bags.
Note!Software Citation Requirements
This course uses open-source software which must be cited when used
for any student work. Citation requirements are on theOpen Source
Applications page.
Please review the installation instruction files to complete your
assignment
Deliverables
There are four exercises in this iLab, although not all of them will be
required for submission. Be sure to read the following instructions
carefully.
Exercise 1: No submission is required.
Exercise 4 contains parts a, b, c and continues through part i. Keep in
mind that the methods developed for each of these parts should be
within the same bag class.
Create a folder and name it Week 1 iLab. Inside this folder, create the
subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three
exercises required for submission in the corresponding subfolder.
Compress the folder Week 1 iLab, and drop the resulting zipped folder
into the Dropbox.
Note that Exercises 2, 3, and 4 require software development. Place in
the corresponding folders only .java files. Do not submit the .class files
or other files or folders that are generated by the IDE.
Required Software
Eclipse
Access the software at https://lab.devry.edu .
iLAB STEPS
Exercise 1: Review of Array-Based Lists
Back to Top
Create a project using the classes in this zip file and name it "A Simple
ArrayList Class." Compile it, run it, and review the code that is given
carefully. This code tests the ArrayList class discussed in the lecture.
Exercise 2: Implementing an Array List
Back to Top
Modify the class ArrayList given in Exercise 1 by using expandable
arrays. That is, if the list is full when an item is being added to this list,
the elements will be moved to a larger array. The new array should have
twice the size of the original array.
Exercise 3: Using an Array-Based List
Back to Top
Using the class ArrayList completed in the previous exercise, write a
program to store 1,000 random numbers, each in the interval [0, 500].
The initial size of the array in the class should be set to 100. Print the
numbers.
Exercise 4: Implementing a Bag Class
Back to Top
Create a class bag (multiset) that uses an expandable array to store the
bag items. The item type must be a Java String type; that is, the bag will
store strings of characters. The class should have the methods listed
below. Create a main class to test your bag class. This main class should
fill a bag with the keywords of the Java language.
Bag(): default constructor
booleanisEmpty(): determines whether the bag is empty
void print(): prints the bag elements
intgetLength(): returns the number of items in the bag
void clear(): removes all of the items from the bag
void add(String item): adds an item to the bag
voidremoveOne(String item): removes item from the bag; only one
occurrence of item should be removed.
voidremoveAll(String item): removes item from the bag; all occurrences
of item should be removed.
int count(String item): counts the number of occurrences of item in the
bag
------------------------------
ECET 370 Week 1 Lab 1
For more course tutorials visit
www.newtonhelp.com
General Instructions
Exercises 1, 2, 4, and 5 use the programs in DocSharinglabeled “User-
defined classes."
Exercises 7 and 8 use the programs in DocSharinglabeled “Using
interfaces."
Exercise 1: Review of classes Create a project using the classes in the
DocSharing area labeled “User-defined classes." Compile it, run it, and
review the code that is given carefully.
Exercise 2: User-defined methods The function area of the Triangle
class is the framework of the actual method. Modify it so that it
calculates the area of the triangle. Write a Main class to test your area
method. Note: to calculate the area of a triangle from the vertices, first
find the distances between each pair of vertices to obtain the length of
the sides of the triangle. Then apply Heron’s formula to calculate the
area given the length of the sides.
Exercise 3: Shallow versus deep copy Provide an example of shallow
copy of objects and an example of deep copy of objects.
Exercise 4: Passing parameters to methods Write a function that swaps
two Point objects. Use the code given below: import java.util.*; public
class Main { public Main() { Scanner Scanner(System.in); System.out.
print("Enter x and y coordinates of first point: "); Point Point
(in.nextDouble(), in.nextDouble()); System.out. print("Enter x and y
coordinates of second point: "); Point Point (in.nextDouble(),
in.nextDouble()); swap(p1, p2); System.out.println(" Compile it, run it,
and review the code that is given carefully. Note: The class Point
implements the Comparable interface. The Comparable interface
contains a single method: compareTo, which is used to compare two
objects p and q of the same class type. When calling p.compareTo(q), it
returns an integer. If this value is negative it means that p is smaller; if it
is equal to zero then , and if the value is positive, it indicates that p is
greater than q.
Exercise 8: Implementation of interfaces Using the class Point in the
DocSharing area labeled “Using interfaces," write an application that
declares an array of Points, fills the array with random points, and finds
the smallest point in the array.
------------------------------
ECET 370 Week 2 ilab Linked Lists (New Syllabus)
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 2 ilab Linked Lists
iLAB OVERVIEW
Scenario and Summary
The purpose of the iLab exercises is to help the student acquire skills in
developing programs that require the implementation with linked lists of
abstract data types, such as lists and bags.
Deliverables
There are four exercises in this iLab, although not all of them will be
required for submission. Be sure to read the following instructions
carefully.
Exercise 1: No submission is required.
Exercise 4 contains Parts a, b, c, d, e, f, g, and h. Keep in mind that the
methods developed for each of these parts should be within the same bag
class.
Create a folder and name it Week 2 iLab. Inside this folder, create the
subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three
exercises required for submission in the corresponding subfolder.
Compress the folder Week 2 iLab, and drop the resulting zipped folder
into the Dropbox.
Note that Exercises 2, 3, and 4 require software development. Place in
the corresponding folders only .java files. Do not submit the .class files
or other files or folders that are generated by the IDE.
Required Software
Eclipse
Access the software at https://lab.devry.edu .
iLAB STEPS
Exercise 1: Review of Linked Lists
Back to Top
Create a project using the classes in "A Simple LinkedList Class."
Compile it, run it, and review the code that is given carefully. This code
tests the LinkedList class provided in the lecture.
Exercise 2: Implementing a Doubly Linked List
Back to Top
Modify the class LinkedList in Exercise 1 to make it a doubly linked list.
Name your class DoublyLinkedList. Add a method addEnd to add an
integer at the end of the list and a method displayInReverse to print the
list backwards:
voidaddEnd(int x): create this method to add x to the end of the list.
voiddisplayInReverse(): create this method to display the list elements
from the last item to the first one.
Create a main class to test your DoublyLinkedList class.
Exercise 3: Using a Doubly Linked List
Back to Top
Using the class DoublyLinkedList completed in the previous exercise,
write a program to store all the prime numbers up to 100 in a
DoublyLinkedList object. The numbers should be stored in such a way
that when “display” is invoked, the listing will be shown in increasing
order: 2, 3, 5, 7, 11, 13, 17, … .
Exercise 4: Implementing a Bag Class
Back to Top
Create a class bag that uses a linked list to store the bag items. The item
type must be a Java String type, that is, the bag will store strings of
characters. The class should have the methods listed below. Create a
main class to test your bag class. This main class should fill a bag with
the keywords of the Java language.
. Bag(): default constructor
booleanisEmpty(): determines whether the bag is empty
void print(): prints the bag elements
intgetLength(): returns the number of items in the bag
void clear(): removes all of the items from the bag
void add(String item): adds an item to the bag
voidremoveOne(String item): removes an item from the bag; only one
occurrence of the item should be removed.
int count(String item): counts the number of occurrences of an item in
the bag.
(Note that you can reuse the code in Exercise 1 for the LinkedList class
to create your bag class. It will help you to save development time.)
------------------------------
ECET 370 Week 2 Lab 2
For more course tutorials visit
www.newtonhelp.com
General Instructions
Exercises 1, 2, and 3 use the programs in DocSharinglabeled “User-
defined array list."
Exercise 4 uses the programs in DocSharinglabeled “Using
java.util.ArrayList."
Exercise 1: Review of array-based lists Create a project using the classes
in the DocSharing area labeled “User-defined array list." Compile it, run
it, and review the code that is given carefully. This code tests the
ArrayList class provided in the lecture.
Exercise 2: A user-defined array list Modify the class ArrayList given in
the lecture by adding to it the functions listed below for Exercise 2. In
each case, the appropriate error message should be generated if an
invalid condition occurs. For example, an error message should be
generated when trying to insert an item in a given location in the list and
the location is out of range. a. ArrayList(int size): create a constructor
that sets the size of the array list to the value passed in size (note that the
class variable SIZE cannot be final anymore). b. int length(): create this
function to determine the number of items in the list (accessor function).
c. intgetSize(): create this function to determine the size of the list
(accessor function). d. void clear(): create this function to remove all of
the items from the list. After this operation, the length of the list is zero.
e. void replace(int location, int item): create this function to replace the
item in the list at the position specified by location. The item should be
replaced with item. f. void insert(int location, int item): create this
function to add an item to the list at the position specified by location. g.
void remove(int item): create this function to delete an item from the list.
All occurrences of item in the list should be removed. h. int get(int
location): create a function that returns the element at location. i. public
ArrayList copy(): create a function that makes a deep copy to another
ArrayList object.
Exercise 3: Using an array-based list Using the class ArrayList
completed in the previous exercise, write a program that uses it to store
100 random numbers. Consider that each of these random numbers is an
integer in the interval [0, 200]. Write the program in such a way that
there are no number duplicates.
Exercise 4: Review of the library class java.util.ArrayList Create a
project using the classes in the DocSharing area labeled “Using
java.util.ArrayList." Compile it, run it, and review the code that is given
carefully. This code is the complete program given in our lecture that
tests the library class java.util.ArrayList.
Exercise 5: Using the library class java.util.ArrayList Rewrite Exercise 3
(above) using the class java.util.ArrayList to store the 100 random
numbers.
------------------------------
ECET 370 Week 3 ilab The Stack and the Queue ADTs (New
Syllabus)
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 3 ilab The Stack and the Queue ADTs
iLAB OVERVIEW
Scenario and Summary
The purpose of the iLab exercises is to help the student acquire skills in
developing programs that involve the use of the stack and the queue data
structures.
Deliverables
There are six exercises in this iLab, although not all of them will be
required for submission. Be sure to read the following instructions
carefully.
Exercises 1 and 4: No submissions are required.
Create a folder and name it Week 3 iLab. Inside this folder, create the
subfolders Ex2, Ex3, Ex5, and Ex6. Place the solution to each of the four
exercises required for submission in the corresponding subfolder.
Compress the folder Week 3 iLab using a program like WinZip, and
drop the resulting zipped folder into the Dropbox.
Note that Exercises 2, 3, 5, and 6 require software development. Place
only .java files in the corresponding folders. Do not submit the .class
files or other files or folders that are generated by the IDE.
Required Software
Eclipse
Access the software at https://lab.devry.edu .
iLAB STEPS
Exercise 1: Review of the Stack ADT
Back to Top
Create a project using the classes in "A Simple Stack Class". Compile
the project, run it, and review the code that is given carefully. This code
tests the stack class provided in the lecture.
Exercise 2: An Improved Stack Class
Back to Top
Modify the stack class to include appropriate error messages if invalid
conditions occur—for example, trying to pop an item when the stack is
empty.
Exercise 3: Using a Stack in an Application
Back to Top
Complete Project 2 at the end of Chapter 5 in our textbook: Write a Java
program that uses a stack to test whether an input string is a palindrome.
Exercise 11 defines "palindrome" and asks you to describe a solution to
this problem. As you can see, you will need to read Exercise 11 to find
the meaning of palindrome.
To implement the solution to this problem, use the stack of characters
from the previous exercises (1 and 2).
Exercise 4: Review of the Queue ADT
Back to Top
Create a project using the classes in "A Simple Queue Class." Compile
the project, run it, and review the code that is given carefully. This code
tests the queue class provided in the lecture.
Exercise 5: An Improved Queue Class
Back to Top
Modify the class queue to include appropriate error messages if invalid
conditions occur—for example, trying to dequeue an item when the
queue is empty.
Exercise 6: Using a Queue in an Application
Back to Top
Complete Project 4 at the end of Chapter 10 in our textbook:Simulate a
small airport with one runway. Airplanes waiting to take off join a queue
on the ground. Planes waiting to land join a queue in the air. Only one
plane can use the runway at any given time. All planes in the air must
land before any plane can take off.
ECET 370 Week 3 Lab 3 Linked Lists
For more course tutorials visit
www.newtonhelp.com
General Instructions
Exercises 1, 2, and 3 use the programs in DocSharinglabeled “User-
defined linked list."
Exercise 4 uses the programs in DocSharinglabeled “Using
java.util.LinkedList."
Exercise 1: Review of Linked Lists Create a project using the classes in
the DocSharing area labeled “User-defined linked list." Compile it, run
it, and review the code that is given carefully. This code tests the
LinkedList class provided in the lecture. Extend the class Main to test
the functions isEmpty, search and remove of the class LinkedList.
Exercise 2: A User-Defined Linked List Modify the class LinkedList
given in the lecture by adding to it the functions listed below for
Exercise 2. In each case, the appropriate error message should be
generated if an invalid condition occurs. a. toString(): modify the display
function to overload the toString function of the Object class. b. int
length(): create this function to determine the number of items in the list
(accessor function). c. void clear(): create this function to remove all of
the items from the list. After this operation is completed, the length of
the list is zero. d. void insertEnd(int item): create this function to insert
item at the end of the list. e. void replace(int location, int item): create
this function to replace the item in the list at the position specified by
location. The item should be replaced with item. f. int get(int location):
create a function that returns the element at the position location.
Exercise 3: Using a Linked List This exercise is similar to Exercise 3 in
Lab 2, but uses the LinkedList class implemented in Exercise 2 above.
That is, using the class LinkedList, write a program that uses it to store
100 random numbers. Again, consider that each of these random
numbers is an integer in the interval [0, 200]. Write the program in such
a way that there are no number duplicates.
Exercise 4: Review of the Library Class java.util.LinkedList Create a
project using the class in the DocSharing area labeled “Using
java.util.LinkedList." Compile it, run it, and review the code that is
given carefully. This code is the complete program given in our lecture
that tests the library class java.util.LinkedList. Exercise 5: Using the
Library Class java.util.LinkedList Rewrite Exercise 3 (above) using the
class java.util.LinkedList to store the 100 random numbers.
------------------------------
ECET 370 Week 4 ilab The Efficiency of Algorithms and
Sorting (New Syllabus)
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 4 ilab The Efficiency of Algorithms and Sorting
iLAB OVERVIEW
Scenario and Summary
The purpose of the lab exercises is to help the student acquire skills in
developing programs that involve algorithm analysis, recursion, and
sorting.
Deliverables
There are four exercises in this lab, although not all of them will be
required for submission. Be sure to read the following instructions
carefully.
Exercise 1: No submission is required.
Note that some of the exercises require sections of code to be timed. To
learn how to time a section of your source code, please refer to the
beginning of the Projects section in Chapter 4 of our textbook.
Exercises 2 and 4 require not only software development but also
explanations about the results of the experiments that are conducted.
Create separate Word documents to provide the details required in these
exercises.
Create a folder and name it Week 4 Lab. Inside this folder, create the
subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three
exercises required for submission in the corresponding subfolder.
Compress the folder Week 4 Lab using a program like WinZip, and
place the resulting zipped folder into the Dropbox.
Note that Exercises 2, 3, and 4 require software development. Place in
the corresponding folders only .java files. Do not submit the .class files
or other files or folders that are generated by the IDE.
Required Software
Eclipse
Access the software at https://lab.devry.edu .
iLAB STEPS
Exercise 1: Review of the Lecture Contents
Back to Top
Create three projects, minimum, factorial, and sorting algorithms, using
the classes in
Minimum
Factorial
Sorting Algorithms
Compile them, run them, and review the code that is given carefully.
These programs test the code discussed in the lecture.
Exercise 2: Efficiency of Algorithms
Back to Top
Problem 3 in the Projects section at the end of Chapter 4 in the textbook:
Find a value of n for which Loop B is faster.
For which value(s) of n was Loop B faster? What have you observed in
running this experiment? Any conclusions? Your observations should be
entered in a separate Word document.
Note: This exercise requires timing code. You can find how to time a
section of code in Java at the beginning of the Projects section in
Chapter 4 of the textbook.
Exercise 3: Recursion
Back to Top
Problem 5 in the Exercises section at the end of Chapter 7 in the
textbook: Write a recursive method that writes a given array backward.
Consider the last element of the array first.
Exercise 4: Sorting
Back to Top
In this week’s lecture, the algorithms quicksort and bubblesort are
described. In Sorting Algorithms you can find the class ArrayList, where
these sorting algorithms are implemented. Write a program that times
both of them for various list lengths, filling the array lists with random
numbers. Use at least 10 different list lengths, and be sure to include
both small values and large values for the list lengths. Create a table to
record the times.
List Length
Bubblesort Time (milliseconds)
Quicksort Time (milliseconds)
Regarding the efficiency of both sorting methods, what conclusion can
be reached from this experiment? Both the table and your conclusions
should be included in a separate Word document.
------------------------------
ECET 370 Week 4 Lab 4 Complexity of Computational
Problems
For more course tutorials visit
www.newtonhelp.com
General Instructions
Exercise 1 uses the programs in DocSharinglabeled “Minimum,"
“Factorial,” and “Sorting algorithms."
Exercise 1: Review of the Lecture Contents Create projects using the
classes in the DocSharing areas labeled “Minimum," “Factorial,” and
“Sorting algorithms." Compile them, run them, and review the code that
is given carefully. These programs test the code discussed in the lecture.
Exercise 2: Efficiency of Algorithms Problem 2 in the Section
“Projects” at the end of Chapter 9 in the textbook: find a value of n for
which Loop B is faster.
Exercise 3: Recursion Problem 1 in the Section “Projects” at the end of
Chapter 10 in the textbook: recursive algorithm to find the square root of
a given number. Exercise 4: Sorting In this week’s lecture, the
algorithms quicksort and bubblesort are described and implemented. In
DocSharing, under the section labeled “Sorting algorithms," you can
find the class ArrayList where these sorting algorithms are implemented.
Write a Java program that times both of them for various values of n.
Create a table to record the times. Regarding the efficiency of both
sorting methods, what conclusion can be reached from this experiment?
Note: You can probably save development time by using the program
from Week 2 to generate a list of the 1000 smallest prime numbers (in
random order). This list could then be used as the input to the sorting
algorithms.
------------------------------
ECET 370 Week 5 ilab Search Techniques and Hashing (New
Syllabus)
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 5 ilab Search Techniques and Hashing
iLAB OVERVIEW
Scenario and Summary
The purpose of the lab exercises is to help the student acquire skills in
developing programs that involve search algorithms and techniques.
Deliverables
There are four exercises in this lab, although not all of them will be
required for submission. Be sure to read the following instructions
carefully.
Exercise 1: No submission is required.
Note that one of the exercises requires sections of code to be timed. To
review how to time a section of your source code, please refer to the
beginning of the Projects section in Chapter 4 of our textbook.
Exercise 2 requires not only software development but also explanations
about the results of the experiments that are conducted. Create a separate
Word document to provide the details required in the exercise.
Create a folder and name it Week 5 Lab. Inside this folder, create the
subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three
exercises required for submission in the corresponding subfolder.
Compress the folder Week 5 Lab, and place the resulting zipped folder
into the Dropbox.
Note that Exercises 2, 3, and 4 require software development. Place in
the corresponding folders only .java files. Do not submit the .class files
or other files or folders that are generated by the IDE.
Required Software
Eclipse
Access the software at https://lab.devry.edu .
iLAB STEPS
Exercise 1: Review of the Lecture Content
Back to Top
Create a project using the ArrayList class and the Main class in Search
Algorithms. The ArrayList class contains implementations of the first
three search methods explained in this week’s lecture: sequential, sorted,
and binary search. The Main class uses these three methods. These
programs test the code discussed in the lecture. Compile the project, run
it, and review the code that is given carefully.
Exercise 2: Search Algorithms and Techniques
Back to Top
Expand the project developed in the previous exercise to perform the
following experiment: Time the sequential search and the binary search
methods several times each for randomly generated values, and record
the results in a table. Do not time individual searches, but groups of
them. For example, time 100 searches together or 1,000 searches
together. Compare the running times of these two search methods that
are obtained during the experiment.
Regarding the efficiency of both search methods, what conclusion can
be reached from this experiment? Both the table and your conclusions
should be included in a separate Word document.
Exercise 3: Searching Applications
Back to Top
The following problem is a variation of Project 4 in the "Projects"
section of Chapter 18 in our textbook:
Consider an array data of n numerical values in sorted order and a list of
two numerical target values. Your goal is to compute the smallest range
of array indices that contains both of the target values. If a target value is
smaller than data[0], the range should start with a -1. If a target value is
larger than data[n-1], the range should end with n.
For example, given the array
0
1
2
3
4
5
6
7
5
8
10
13
15
20
22
26
the following table illustrates target values and their corresponding
ranges:
Target Values
Smellest Range of Indices
2, 8
[-1, 1]
9, 14
[1, 4]
12, 21
[2, 6]
14, 30
[3, 8]
Devise and implement an algorithm that solves this problem.
Exercise 4: Hashing
Back to Top
Suppose that the type of key in a hashing application you are
implementing is string (Sections 21.7 and 21.8 in our textbook explain
hash functions for strings). Design and implement a hash function that
converts a key to a hash value. Test your function by computing the hash
values for the Java keywords. Was a key collision produced?
------------------------------
ECET 370 Week 5 Lab 5 Search Algorithms and Techniques
For more course tutorials visit
www.newtonhelp.com
General Instructions
Exercise 1 uses the programs in DocSharinglabeled “Search algorithms."
Exercise 1: Review of the Lecture Content Create a project using the
ArrayList class and the Main class provided in DocSharing. The
ArrayList class contains implementations of the first three search
methods explained in this week’s lecture: sequential, sorted, and binary
search. The Main class uses these three methods. These programs test
the code discussed in the lecture. Compile the project, run it, and review
the code that is given carefully.
Exercise 2: Search Algorithms and Techniques Expand the project
developed in the previous exercise to perform the following experiment:
time the three search methods several times each and record the results.
Compare the running times of the three search methods (sequential
search, sorted search, and binary search) which are obtained during the
experiment. What conclusions can be drawn?
Exercise 3: Searching Applications Select one of the following two
problems to solve: Problem 1: Design and implement an algorithm that
determines whether or not a given array of elements, list1, is completely
contained within another given array of elements, list2. Consider two
different scenarios: 1) both arrays are sorted; 2) both arrays are unsorted.
Problem 2: Design an algorithm that when given a collection of integers
in an unsorted array, determines the second smallest number (or second
minimum). For example, if the array consists of the values 12, 23, 9, 17,
3, the algorithm should report the value 9, since it is the second smallest
number in the array. Write a function that receives an array as a
parameter and returns the second smallest number. To test your function,
write a program that populates an array with random numbers and then
call your function. Exercise 4: Hashing Suppose that the type of key in a
hashing application you are implementing is String (Sections 19.6 and
19.7 in our textbook explain hash functions for strings). Design,
implement, and test a hash function that converts a key to a hash value.
Assume that the size of the hash table is a prime number.
------------------------------
ECET 370 Week 6 ilab Binary Trees (New Syllabus)
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 6 ilab Binary Trees
iLAB OVERVIEW
Scenario and Summary
The purpose of the lab exercises is to help the student acquire skills in
developing programs that involve the use of binary trees. We will be
concentrating primarily on binary search trees, or BSTs.
Deliverables
There are five exercises in this lab, although not all of them will be
required for submission. Be sure to read the following instructions
carefully.
Exercise 1: No submission is required.
Create a folder and name it Week 6 Lab. Inside this folder, create the
subfolders Ex2, Ex3, Ex4, and Ex5. Place the solution to each of the four
exercises required for submission in the corresponding subfolder.
Compress the folder Week 6 Lab, and place the resulting zipped folder
into the Dropbox.
Note that Exercises 2, 3, 4, and 5 require software development. Place in
the corresponding folders only .java files. Do not submit the .class files
or other files or folders that are generated by the IDE.
Required Software
Eclipse
Access the software at https://lab.devry.edu .
iLAB STEPS
Exercise 1: Lecture Review—Binary Search Tree
Back to Top
Create a project using the classes BinarySearchTree, Node, and Main in
Binary Search Tree. Compile the project, run it, and review the code that
is given carefully. These programs test the code discussed in our lecture.
Exercise 2: An Improved BST Class
Back to Top
Add the toString method to the class BinarySearchTree in Exercise 1.
Note: The toString method returns a string representation of the object
properties. By implementing toString, a BinarySearchTree object can be
displayed in a simple way using System.out.print or System.out.println.
For example, if bst is a BinarySearchTree object, it can be printed using
System.out.println(bst).
Exercise 3: Using a BST in an Application
Back to Top
Create a class SimpleBag that uses a binary search tree to store the bag
items.The class should have the methods listed below. Create a Main
class to test your SimpleBag class.
SimpleBag(): default constructor; creates an empty bag
booleanisEmpty(): determines whether the bag is empty
void print(): prints the SimpleBag elements
void clear(): removes all of the items from the bag
void add(int item): adds an item to the bag
int count(int item): counts the number of occurrences of items in the bag.
Exercise 4: Recursion and Binary Trees
Back to Top
Add a recursive function getHeight to the BinarySearchTree class in
Exercise 1 that returns the height of the tree. Create a Main class to test
it.
Exercise 5: Using Properties of BSTs
Back to Top
Add methods preorderDisplay and postorderDisplay to the
BinarySearchTree class in Exercise 1 to print the items in the BST listed
in preorder and postorder, respectively. Create a Main class to test them.
------------------------------
ECET 370 Week 7 ilab Collections Framework (New Syllabus)
For more course tutorials visit
www.newtonhelp.com
ECET 370 Week 7 ilab Collections Framework
iLAB OVERVIEW
Scenario and Summary
The purpose of the lab exercises is to help the student acquire skills in
developing programs that involve the use of the collections framework.
Deliverables
There are five exercises in this lab, although not all of them will be
required for submission. Be sure to read the following instructions
carefully.
Exercise 1: No submission is required.
Create a folder and name it Week 7 Lab. Inside this folder, create the
subfolders Ex2, Ex3, Ex4, and Ex5. Place the solution to each of the four
exercises required for submission in the corresponding subfolder.
Compress the folder Week 7 Lab, and drop the resulting zipped folder
into the Dropbox.
Note that Exercises 2, 3, 4, and 5 require software development. Place
only source files in the corresponding folders. Do not submit other types
of files or folders that are generated by the IDE.
Exercises 2 and 4 should be implemented using the Java programming
language, and Exercises 3 and 5 should be implemented using the C++
programming language. Exercise 1 requires both.
Required Software
Eclipse
Access the software at https://lab.devry.edu .
Microsoft Visual Studio 2012
Access the software at https://lab.devry.edu .
iLAB STEPS
Exercise 1: Lecture Review—JCF and STL
Back to Top
Create seven projects, JCF array list, JCF linked list, JCF sort,JCF stack,
STL doubly linked list, STL stack and queue, and STL vector, using the
programs in:
JCF array list
JCF linked list
JCF sort
JCF stack
STL doubly linked list
STL stack and queue
STL vector
Compile the projects, run them, and review the code that is given
carefully. These programs test the code discussed in our lecture.
Exercise 2: Using the JCF ArrayList
Back to Top
Write a Java program to store 1,000 random numbers, each in the
interval [0, 500], in a java.util.ArrayList object. Print the numbers.
Exercise 3: Using the STL Vector
Back to Top
Write a C++ program to store the first 20 factorials: 1!, 2!, 3!, . . . , 20!
in a vector object.
Exercise 4: Developing an Application with JCF
Back to Top
Complete Project 2 at the end of Chapter 5 in our textbook: Write a Java
program that uses a stack to test whether an input string is a palindrome.
To implement the solution to this problem, use the stack data structure in
JCF.
Note that this exercise is a variation of Exercise 3 in the lab of Week 3.
Exercise 5: Developing an Application with C++ STL
Back to Top
Complete Project 4 at the end of Chapter 10 in our textbook:Simulate a
small airport with one runway. Airplanes waiting to take off join a queue
on the ground. Planes waiting to land join a queue in the air. Only one
plane can use the runway at any given time. All planes in the air must
land before any plane can take off. To implement the solution to this
problem, use the queue data structure in C++ STL.
Note that this exercise is a variation of Exercise 6 in the lab of Week 3.
------------------------------
ECET 370 Week 7 Lab 7 Binary Trees
For more course tutorials visit
www.newtonhelp.com
Full set of lab with working programs.
Exercise 1: Lecture review: Binary Search Tree Create a project using
the classes BinarySearchTree, Node, and Main in the DocSharing area
labeled “The BST." Compile the project, run it, and review the code that
is given carefully. These programs test the code discussed in our lecture.
Exercise 2: An improved BST class Modify the class BinarySearchTree
so that it contains the toString method, instead of the display method that
was given originally.
Exercise 3: Using a BST in an application Use a binary search tree to
implement a dictionary that contains the keywords in the Java language.
Test it. Note that you can use the programs from the previous exercises.
For a list of the keywords in Java, visit
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.ht
ml.
Exercise 4: Recursion and Binary Trees Write a recursive algorithm that
counts the nodes in a binary search tree.
Exercise 5: Using properties of BSTs Write an algorithm getMax to find
the maximum value stored in a binary search tree.

More Related Content

What's hot

Ecet 370 Education Organization -- snaptutorial.com
Ecet 370   Education Organization -- snaptutorial.comEcet 370   Education Organization -- snaptutorial.com
Ecet 370 Education Organization -- snaptutorial.comDavisMurphyB81
 
66781291 java-lab-manual
66781291 java-lab-manual66781291 java-lab-manual
66781291 java-lab-manualLaura Popovici
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manualnahalomar
 
Object Oriented Programming Lab Manual
Object Oriented Programming Lab Manual Object Oriented Programming Lab Manual
Object Oriented Programming Lab Manual Abdul Hannan
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newmybrands2
 
Cs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUALCs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUALPrabhu D
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newolivergeorg
 
Object oriented programming la bmanual jntu
Object oriented programming la bmanual jntuObject oriented programming la bmanual jntu
Object oriented programming la bmanual jntuKhurshid Asghar
 
Ch01 basic-java-programs
Ch01 basic-java-programsCh01 basic-java-programs
Ch01 basic-java-programsJames Brotsos
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manualsameer farooq
 

What's hot (18)

Ecet 370 Education Organization -- snaptutorial.com
Ecet 370   Education Organization -- snaptutorial.comEcet 370   Education Organization -- snaptutorial.com
Ecet 370 Education Organization -- snaptutorial.com
 
Ecet 370 week 2 lab 2
Ecet 370 week 2 lab 2Ecet 370 week 2 lab 2
Ecet 370 week 2 lab 2
 
Java lab-manual
Java lab-manualJava lab-manual
Java lab-manual
 
66781291 java-lab-manual
66781291 java-lab-manual66781291 java-lab-manual
66781291 java-lab-manual
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
 
Icom4015 lecture10-f16
Icom4015 lecture10-f16Icom4015 lecture10-f16
Icom4015 lecture10-f16
 
Object Oriented Programming Lab Manual
Object Oriented Programming Lab Manual Object Oriented Programming Lab Manual
Object Oriented Programming Lab Manual
 
Java lab 2
Java lab 2Java lab 2
Java lab 2
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees new
 
All experiment of java
All experiment of javaAll experiment of java
All experiment of java
 
Cs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUALCs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUAL
 
Collections
CollectionsCollections
Collections
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees new
 
Object oriented programming la bmanual jntu
Object oriented programming la bmanual jntuObject oriented programming la bmanual jntu
Object oriented programming la bmanual jntu
 
CS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUALCS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUAL
 
Ch01 basic-java-programs
Ch01 basic-java-programsCh01 basic-java-programs
Ch01 basic-java-programs
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manual
 
Java Lab Manual
Java Lab ManualJava Lab Manual
Java Lab Manual
 

Similar to ECET 370 Success Begins/Newtonhelp.com

Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arraymybrands2
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arraynikig6806
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arraymailemail
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayolivergeorg
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayuopassignment
 
ECET 370 Entire Course NEW
ECET 370 Entire Course NEWECET 370 Entire Course NEW
ECET 370 Entire Course NEWshyamuopuop
 
ECET 370 Exceptional Education - snaptutorial.com
ECET 370 Exceptional Education - snaptutorial.com ECET 370 Exceptional Education - snaptutorial.com
ECET 370 Exceptional Education - snaptutorial.com donaldzs157
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newnikig6806
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newmybrands2
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newmailemail
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newolivergeorg
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newuopassignment
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newmailemail
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newuopassignment
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newolivergeorg
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newmybrands2
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newnikig6806
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newmailemail
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newuopassignment
 

Similar to ECET 370 Success Begins/Newtonhelp.com (20)

Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab array
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab array
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab array
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab array
 
Devry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab arrayDevry ecet 370 week 1 i lab array
Devry ecet 370 week 1 i lab array
 
ECET 370 Entire Course NEW
ECET 370 Entire Course NEWECET 370 Entire Course NEW
ECET 370 Entire Course NEW
 
ECET 370 Exceptional Education - snaptutorial.com
ECET 370 Exceptional Education - snaptutorial.com ECET 370 Exceptional Education - snaptutorial.com
ECET 370 Exceptional Education - snaptutorial.com
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists new
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists new
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists new
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists new
 
Devry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists newDevry ecet 370 week 2 ilab linked lists new
Devry ecet 370 week 2 ilab linked lists new
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees new
 
Devry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees newDevry ecet 370 week 6 ilab binary trees new
Devry ecet 370 week 6 ilab binary trees new
 
Ecet 370 week 1 lab
Ecet 370 week 1 labEcet 370 week 1 lab
Ecet 370 week 1 lab
 

Recently uploaded

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
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
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 

Recently uploaded (20)

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
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
 
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
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 

ECET 370 Success Begins/Newtonhelp.com

  • 1. ECET 370 Entire Course For more course tutorials visit www.newtonhelp.com ECET 370 Week 1 Lab 1 ECET 370 Week 2 Lab 2 ECET 370 Week 3 Lab 3 Linked Lists ECET 370 Week 4 Lab 4 Complexity of Computational Problems ECET 370 Week 5 Lab 5 Search Algorithms and Techniques ECET 370 Week 7 Lab 7 Binary Trees ------------------------------ ECET 370 Week 1 iLab Array Based Implementations (New Syllabus) For more course tutorials visit www.newtonhelp.com ECET 370 Week 1 iLab Array-Based Implementations iLAB OVERVIEW Scenario and Summary
  • 2. The purpose of the iLab exercises is to help the student acquire skills in developing programs that require implementation with arrays of abstract data types, such as lists and bags. Note!Software Citation Requirements This course uses open-source software which must be cited when used for any student work. Citation requirements are on theOpen Source Applications page. Please review the installation instruction files to complete your assignment Deliverables There are four exercises in this iLab, although not all of them will be required for submission. Be sure to read the following instructions carefully. Exercise 1: No submission is required. Exercise 4 contains parts a, b, c and continues through part i. Keep in mind that the methods developed for each of these parts should be within the same bag class. Create a folder and name it Week 1 iLab. Inside this folder, create the subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three exercises required for submission in the corresponding subfolder. Compress the folder Week 1 iLab, and drop the resulting zipped folder into the Dropbox. Note that Exercises 2, 3, and 4 require software development. Place in the corresponding folders only .java files. Do not submit the .class files or other files or folders that are generated by the IDE. Required Software
  • 3. Eclipse Access the software at https://lab.devry.edu . iLAB STEPS Exercise 1: Review of Array-Based Lists Back to Top Create a project using the classes in this zip file and name it "A Simple ArrayList Class." Compile it, run it, and review the code that is given carefully. This code tests the ArrayList class discussed in the lecture. Exercise 2: Implementing an Array List Back to Top Modify the class ArrayList given in Exercise 1 by using expandable arrays. That is, if the list is full when an item is being added to this list, the elements will be moved to a larger array. The new array should have twice the size of the original array. Exercise 3: Using an Array-Based List Back to Top Using the class ArrayList completed in the previous exercise, write a program to store 1,000 random numbers, each in the interval [0, 500]. The initial size of the array in the class should be set to 100. Print the numbers. Exercise 4: Implementing a Bag Class Back to Top
  • 4. Create a class bag (multiset) that uses an expandable array to store the bag items. The item type must be a Java String type; that is, the bag will store strings of characters. The class should have the methods listed below. Create a main class to test your bag class. This main class should fill a bag with the keywords of the Java language. Bag(): default constructor booleanisEmpty(): determines whether the bag is empty void print(): prints the bag elements intgetLength(): returns the number of items in the bag void clear(): removes all of the items from the bag void add(String item): adds an item to the bag voidremoveOne(String item): removes item from the bag; only one occurrence of item should be removed. voidremoveAll(String item): removes item from the bag; all occurrences of item should be removed. int count(String item): counts the number of occurrences of item in the bag ------------------------------ ECET 370 Week 1 Lab 1 For more course tutorials visit www.newtonhelp.com
  • 5. General Instructions Exercises 1, 2, 4, and 5 use the programs in DocSharinglabeled “User- defined classes." Exercises 7 and 8 use the programs in DocSharinglabeled “Using interfaces." Exercise 1: Review of classes Create a project using the classes in the DocSharing area labeled “User-defined classes." Compile it, run it, and review the code that is given carefully. Exercise 2: User-defined methods The function area of the Triangle class is the framework of the actual method. Modify it so that it calculates the area of the triangle. Write a Main class to test your area method. Note: to calculate the area of a triangle from the vertices, first find the distances between each pair of vertices to obtain the length of the sides of the triangle. Then apply Heron’s formula to calculate the area given the length of the sides. Exercise 3: Shallow versus deep copy Provide an example of shallow copy of objects and an example of deep copy of objects. Exercise 4: Passing parameters to methods Write a function that swaps two Point objects. Use the code given below: import java.util.*; public class Main { public Main() { Scanner Scanner(System.in); System.out. print("Enter x and y coordinates of first point: "); Point Point (in.nextDouble(), in.nextDouble()); System.out. print("Enter x and y coordinates of second point: "); Point Point (in.nextDouble(), in.nextDouble()); swap(p1, p2); System.out.println(" Compile it, run it, and review the code that is given carefully. Note: The class Point implements the Comparable interface. The Comparable interface
  • 6. contains a single method: compareTo, which is used to compare two objects p and q of the same class type. When calling p.compareTo(q), it returns an integer. If this value is negative it means that p is smaller; if it is equal to zero then , and if the value is positive, it indicates that p is greater than q. Exercise 8: Implementation of interfaces Using the class Point in the DocSharing area labeled “Using interfaces," write an application that declares an array of Points, fills the array with random points, and finds the smallest point in the array. ------------------------------ ECET 370 Week 2 ilab Linked Lists (New Syllabus) For more course tutorials visit www.newtonhelp.com ECET 370 Week 2 ilab Linked Lists iLAB OVERVIEW Scenario and Summary The purpose of the iLab exercises is to help the student acquire skills in developing programs that require the implementation with linked lists of abstract data types, such as lists and bags. Deliverables
  • 7. There are four exercises in this iLab, although not all of them will be required for submission. Be sure to read the following instructions carefully. Exercise 1: No submission is required. Exercise 4 contains Parts a, b, c, d, e, f, g, and h. Keep in mind that the methods developed for each of these parts should be within the same bag class. Create a folder and name it Week 2 iLab. Inside this folder, create the subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three exercises required for submission in the corresponding subfolder. Compress the folder Week 2 iLab, and drop the resulting zipped folder into the Dropbox. Note that Exercises 2, 3, and 4 require software development. Place in the corresponding folders only .java files. Do not submit the .class files or other files or folders that are generated by the IDE. Required Software Eclipse Access the software at https://lab.devry.edu . iLAB STEPS Exercise 1: Review of Linked Lists
  • 8. Back to Top Create a project using the classes in "A Simple LinkedList Class." Compile it, run it, and review the code that is given carefully. This code tests the LinkedList class provided in the lecture. Exercise 2: Implementing a Doubly Linked List Back to Top Modify the class LinkedList in Exercise 1 to make it a doubly linked list. Name your class DoublyLinkedList. Add a method addEnd to add an integer at the end of the list and a method displayInReverse to print the list backwards: voidaddEnd(int x): create this method to add x to the end of the list. voiddisplayInReverse(): create this method to display the list elements from the last item to the first one. Create a main class to test your DoublyLinkedList class. Exercise 3: Using a Doubly Linked List Back to Top Using the class DoublyLinkedList completed in the previous exercise, write a program to store all the prime numbers up to 100 in a DoublyLinkedList object. The numbers should be stored in such a way that when “display” is invoked, the listing will be shown in increasing order: 2, 3, 5, 7, 11, 13, 17, … . Exercise 4: Implementing a Bag Class
  • 9. Back to Top Create a class bag that uses a linked list to store the bag items. The item type must be a Java String type, that is, the bag will store strings of characters. The class should have the methods listed below. Create a main class to test your bag class. This main class should fill a bag with the keywords of the Java language. . Bag(): default constructor booleanisEmpty(): determines whether the bag is empty void print(): prints the bag elements intgetLength(): returns the number of items in the bag void clear(): removes all of the items from the bag void add(String item): adds an item to the bag voidremoveOne(String item): removes an item from the bag; only one occurrence of the item should be removed. int count(String item): counts the number of occurrences of an item in the bag. (Note that you can reuse the code in Exercise 1 for the LinkedList class to create your bag class. It will help you to save development time.) ------------------------------ ECET 370 Week 2 Lab 2
  • 10. For more course tutorials visit www.newtonhelp.com General Instructions Exercises 1, 2, and 3 use the programs in DocSharinglabeled “User- defined array list." Exercise 4 uses the programs in DocSharinglabeled “Using java.util.ArrayList." Exercise 1: Review of array-based lists Create a project using the classes in the DocSharing area labeled “User-defined array list." Compile it, run it, and review the code that is given carefully. This code tests the ArrayList class provided in the lecture. Exercise 2: A user-defined array list Modify the class ArrayList given in the lecture by adding to it the functions listed below for Exercise 2. In each case, the appropriate error message should be generated if an invalid condition occurs. For example, an error message should be generated when trying to insert an item in a given location in the list and the location is out of range. a. ArrayList(int size): create a constructor that sets the size of the array list to the value passed in size (note that the class variable SIZE cannot be final anymore). b. int length(): create this function to determine the number of items in the list (accessor function). c. intgetSize(): create this function to determine the size of the list (accessor function). d. void clear(): create this function to remove all of the items from the list. After this operation, the length of the list is zero. e. void replace(int location, int item): create this function to replace the item in the list at the position specified by location. The item should be
  • 11. replaced with item. f. void insert(int location, int item): create this function to add an item to the list at the position specified by location. g. void remove(int item): create this function to delete an item from the list. All occurrences of item in the list should be removed. h. int get(int location): create a function that returns the element at location. i. public ArrayList copy(): create a function that makes a deep copy to another ArrayList object. Exercise 3: Using an array-based list Using the class ArrayList completed in the previous exercise, write a program that uses it to store 100 random numbers. Consider that each of these random numbers is an integer in the interval [0, 200]. Write the program in such a way that there are no number duplicates. Exercise 4: Review of the library class java.util.ArrayList Create a project using the classes in the DocSharing area labeled “Using java.util.ArrayList." Compile it, run it, and review the code that is given carefully. This code is the complete program given in our lecture that tests the library class java.util.ArrayList. Exercise 5: Using the library class java.util.ArrayList Rewrite Exercise 3 (above) using the class java.util.ArrayList to store the 100 random numbers. ------------------------------ ECET 370 Week 3 ilab The Stack and the Queue ADTs (New Syllabus) For more course tutorials visit www.newtonhelp.com
  • 12. ECET 370 Week 3 ilab The Stack and the Queue ADTs iLAB OVERVIEW Scenario and Summary The purpose of the iLab exercises is to help the student acquire skills in developing programs that involve the use of the stack and the queue data structures. Deliverables There are six exercises in this iLab, although not all of them will be required for submission. Be sure to read the following instructions carefully. Exercises 1 and 4: No submissions are required. Create a folder and name it Week 3 iLab. Inside this folder, create the subfolders Ex2, Ex3, Ex5, and Ex6. Place the solution to each of the four exercises required for submission in the corresponding subfolder. Compress the folder Week 3 iLab using a program like WinZip, and drop the resulting zipped folder into the Dropbox. Note that Exercises 2, 3, 5, and 6 require software development. Place only .java files in the corresponding folders. Do not submit the .class files or other files or folders that are generated by the IDE. Required Software
  • 13. Eclipse Access the software at https://lab.devry.edu . iLAB STEPS Exercise 1: Review of the Stack ADT Back to Top Create a project using the classes in "A Simple Stack Class". Compile the project, run it, and review the code that is given carefully. This code tests the stack class provided in the lecture. Exercise 2: An Improved Stack Class Back to Top Modify the stack class to include appropriate error messages if invalid conditions occur—for example, trying to pop an item when the stack is empty. Exercise 3: Using a Stack in an Application Back to Top Complete Project 2 at the end of Chapter 5 in our textbook: Write a Java program that uses a stack to test whether an input string is a palindrome. Exercise 11 defines "palindrome" and asks you to describe a solution to
  • 14. this problem. As you can see, you will need to read Exercise 11 to find the meaning of palindrome. To implement the solution to this problem, use the stack of characters from the previous exercises (1 and 2). Exercise 4: Review of the Queue ADT Back to Top Create a project using the classes in "A Simple Queue Class." Compile the project, run it, and review the code that is given carefully. This code tests the queue class provided in the lecture. Exercise 5: An Improved Queue Class Back to Top Modify the class queue to include appropriate error messages if invalid conditions occur—for example, trying to dequeue an item when the queue is empty. Exercise 6: Using a Queue in an Application Back to Top Complete Project 4 at the end of Chapter 10 in our textbook:Simulate a small airport with one runway. Airplanes waiting to take off join a queue on the ground. Planes waiting to land join a queue in the air. Only one plane can use the runway at any given time. All planes in the air must land before any plane can take off.
  • 15. ECET 370 Week 3 Lab 3 Linked Lists For more course tutorials visit www.newtonhelp.com General Instructions Exercises 1, 2, and 3 use the programs in DocSharinglabeled “User- defined linked list." Exercise 4 uses the programs in DocSharinglabeled “Using java.util.LinkedList." Exercise 1: Review of Linked Lists Create a project using the classes in the DocSharing area labeled “User-defined linked list." Compile it, run it, and review the code that is given carefully. This code tests the LinkedList class provided in the lecture. Extend the class Main to test the functions isEmpty, search and remove of the class LinkedList. Exercise 2: A User-Defined Linked List Modify the class LinkedList given in the lecture by adding to it the functions listed below for Exercise 2. In each case, the appropriate error message should be generated if an invalid condition occurs. a. toString(): modify the display function to overload the toString function of the Object class. b. int length(): create this function to determine the number of items in the list (accessor function). c. void clear(): create this function to remove all of the items from the list. After this operation is completed, the length of the list is zero. d. void insertEnd(int item): create this function to insert item at the end of the list. e. void replace(int location, int item): create this function to replace the item in the list at the position specified by
  • 16. location. The item should be replaced with item. f. int get(int location): create a function that returns the element at the position location. Exercise 3: Using a Linked List This exercise is similar to Exercise 3 in Lab 2, but uses the LinkedList class implemented in Exercise 2 above. That is, using the class LinkedList, write a program that uses it to store 100 random numbers. Again, consider that each of these random numbers is an integer in the interval [0, 200]. Write the program in such a way that there are no number duplicates. Exercise 4: Review of the Library Class java.util.LinkedList Create a project using the class in the DocSharing area labeled “Using java.util.LinkedList." Compile it, run it, and review the code that is given carefully. This code is the complete program given in our lecture that tests the library class java.util.LinkedList. Exercise 5: Using the Library Class java.util.LinkedList Rewrite Exercise 3 (above) using the class java.util.LinkedList to store the 100 random numbers. ------------------------------ ECET 370 Week 4 ilab The Efficiency of Algorithms and Sorting (New Syllabus) For more course tutorials visit www.newtonhelp.com ECET 370 Week 4 ilab The Efficiency of Algorithms and Sorting iLAB OVERVIEW
  • 17. Scenario and Summary The purpose of the lab exercises is to help the student acquire skills in developing programs that involve algorithm analysis, recursion, and sorting. Deliverables There are four exercises in this lab, although not all of them will be required for submission. Be sure to read the following instructions carefully. Exercise 1: No submission is required. Note that some of the exercises require sections of code to be timed. To learn how to time a section of your source code, please refer to the beginning of the Projects section in Chapter 4 of our textbook. Exercises 2 and 4 require not only software development but also explanations about the results of the experiments that are conducted. Create separate Word documents to provide the details required in these exercises. Create a folder and name it Week 4 Lab. Inside this folder, create the subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three exercises required for submission in the corresponding subfolder. Compress the folder Week 4 Lab using a program like WinZip, and place the resulting zipped folder into the Dropbox. Note that Exercises 2, 3, and 4 require software development. Place in the corresponding folders only .java files. Do not submit the .class files or other files or folders that are generated by the IDE.
  • 18. Required Software Eclipse Access the software at https://lab.devry.edu . iLAB STEPS Exercise 1: Review of the Lecture Contents Back to Top Create three projects, minimum, factorial, and sorting algorithms, using the classes in Minimum Factorial Sorting Algorithms Compile them, run them, and review the code that is given carefully. These programs test the code discussed in the lecture. Exercise 2: Efficiency of Algorithms Back to Top Problem 3 in the Projects section at the end of Chapter 4 in the textbook: Find a value of n for which Loop B is faster.
  • 19. For which value(s) of n was Loop B faster? What have you observed in running this experiment? Any conclusions? Your observations should be entered in a separate Word document. Note: This exercise requires timing code. You can find how to time a section of code in Java at the beginning of the Projects section in Chapter 4 of the textbook. Exercise 3: Recursion Back to Top Problem 5 in the Exercises section at the end of Chapter 7 in the textbook: Write a recursive method that writes a given array backward. Consider the last element of the array first. Exercise 4: Sorting Back to Top In this week’s lecture, the algorithms quicksort and bubblesort are described. In Sorting Algorithms you can find the class ArrayList, where these sorting algorithms are implemented. Write a program that times both of them for various list lengths, filling the array lists with random numbers. Use at least 10 different list lengths, and be sure to include both small values and large values for the list lengths. Create a table to record the times. List Length Bubblesort Time (milliseconds) Quicksort Time (milliseconds)
  • 20. Regarding the efficiency of both sorting methods, what conclusion can be reached from this experiment? Both the table and your conclusions should be included in a separate Word document. ------------------------------ ECET 370 Week 4 Lab 4 Complexity of Computational Problems For more course tutorials visit www.newtonhelp.com General Instructions Exercise 1 uses the programs in DocSharinglabeled “Minimum," “Factorial,” and “Sorting algorithms." Exercise 1: Review of the Lecture Contents Create projects using the classes in the DocSharing areas labeled “Minimum," “Factorial,” and “Sorting algorithms." Compile them, run them, and review the code that is given carefully. These programs test the code discussed in the lecture. Exercise 2: Efficiency of Algorithms Problem 2 in the Section “Projects” at the end of Chapter 9 in the textbook: find a value of n for which Loop B is faster. Exercise 3: Recursion Problem 1 in the Section “Projects” at the end of Chapter 10 in the textbook: recursive algorithm to find the square root of a given number. Exercise 4: Sorting In this week’s lecture, the algorithms quicksort and bubblesort are described and implemented. In
  • 21. DocSharing, under the section labeled “Sorting algorithms," you can find the class ArrayList where these sorting algorithms are implemented. Write a Java program that times both of them for various values of n. Create a table to record the times. Regarding the efficiency of both sorting methods, what conclusion can be reached from this experiment? Note: You can probably save development time by using the program from Week 2 to generate a list of the 1000 smallest prime numbers (in random order). This list could then be used as the input to the sorting algorithms. ------------------------------ ECET 370 Week 5 ilab Search Techniques and Hashing (New Syllabus) For more course tutorials visit www.newtonhelp.com ECET 370 Week 5 ilab Search Techniques and Hashing iLAB OVERVIEW Scenario and Summary The purpose of the lab exercises is to help the student acquire skills in developing programs that involve search algorithms and techniques. Deliverables
  • 22. There are four exercises in this lab, although not all of them will be required for submission. Be sure to read the following instructions carefully. Exercise 1: No submission is required. Note that one of the exercises requires sections of code to be timed. To review how to time a section of your source code, please refer to the beginning of the Projects section in Chapter 4 of our textbook. Exercise 2 requires not only software development but also explanations about the results of the experiments that are conducted. Create a separate Word document to provide the details required in the exercise. Create a folder and name it Week 5 Lab. Inside this folder, create the subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three exercises required for submission in the corresponding subfolder. Compress the folder Week 5 Lab, and place the resulting zipped folder into the Dropbox. Note that Exercises 2, 3, and 4 require software development. Place in the corresponding folders only .java files. Do not submit the .class files or other files or folders that are generated by the IDE. Required Software Eclipse Access the software at https://lab.devry.edu . iLAB STEPS
  • 23. Exercise 1: Review of the Lecture Content Back to Top Create a project using the ArrayList class and the Main class in Search Algorithms. The ArrayList class contains implementations of the first three search methods explained in this week’s lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully. Exercise 2: Search Algorithms and Techniques Back to Top Expand the project developed in the previous exercise to perform the following experiment: Time the sequential search and the binary search methods several times each for randomly generated values, and record the results in a table. Do not time individual searches, but groups of them. For example, time 100 searches together or 1,000 searches together. Compare the running times of these two search methods that are obtained during the experiment. Regarding the efficiency of both search methods, what conclusion can be reached from this experiment? Both the table and your conclusions should be included in a separate Word document. Exercise 3: Searching Applications Back to Top
  • 24. The following problem is a variation of Project 4 in the "Projects" section of Chapter 18 in our textbook: Consider an array data of n numerical values in sorted order and a list of two numerical target values. Your goal is to compute the smallest range of array indices that contains both of the target values. If a target value is smaller than data[0], the range should start with a -1. If a target value is larger than data[n-1], the range should end with n. For example, given the array 0 1 2 3 4 5 6 7 5 8 10 13 15 20
  • 25. 22 26 the following table illustrates target values and their corresponding ranges: Target Values Smellest Range of Indices 2, 8 [-1, 1] 9, 14 [1, 4] 12, 21 [2, 6] 14, 30 [3, 8] Devise and implement an algorithm that solves this problem. Exercise 4: Hashing Back to Top Suppose that the type of key in a hashing application you are implementing is string (Sections 21.7 and 21.8 in our textbook explain hash functions for strings). Design and implement a hash function that
  • 26. converts a key to a hash value. Test your function by computing the hash values for the Java keywords. Was a key collision produced? ------------------------------ ECET 370 Week 5 Lab 5 Search Algorithms and Techniques For more course tutorials visit www.newtonhelp.com General Instructions Exercise 1 uses the programs in DocSharinglabeled “Search algorithms." Exercise 1: Review of the Lecture Content Create a project using the ArrayList class and the Main class provided in DocSharing. The ArrayList class contains implementations of the first three search methods explained in this week’s lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully. Exercise 2: Search Algorithms and Techniques Expand the project developed in the previous exercise to perform the following experiment: time the three search methods several times each and record the results.
  • 27. Compare the running times of the three search methods (sequential search, sorted search, and binary search) which are obtained during the experiment. What conclusions can be drawn? Exercise 3: Searching Applications Select one of the following two problems to solve: Problem 1: Design and implement an algorithm that determines whether or not a given array of elements, list1, is completely contained within another given array of elements, list2. Consider two different scenarios: 1) both arrays are sorted; 2) both arrays are unsorted. Problem 2: Design an algorithm that when given a collection of integers in an unsorted array, determines the second smallest number (or second minimum). For example, if the array consists of the values 12, 23, 9, 17, 3, the algorithm should report the value 9, since it is the second smallest number in the array. Write a function that receives an array as a parameter and returns the second smallest number. To test your function, write a program that populates an array with random numbers and then call your function. Exercise 4: Hashing Suppose that the type of key in a hashing application you are implementing is String (Sections 19.6 and 19.7 in our textbook explain hash functions for strings). Design, implement, and test a hash function that converts a key to a hash value. Assume that the size of the hash table is a prime number. ------------------------------ ECET 370 Week 6 ilab Binary Trees (New Syllabus) For more course tutorials visit www.newtonhelp.com
  • 28. ECET 370 Week 6 ilab Binary Trees iLAB OVERVIEW Scenario and Summary The purpose of the lab exercises is to help the student acquire skills in developing programs that involve the use of binary trees. We will be concentrating primarily on binary search trees, or BSTs. Deliverables There are five exercises in this lab, although not all of them will be required for submission. Be sure to read the following instructions carefully. Exercise 1: No submission is required. Create a folder and name it Week 6 Lab. Inside this folder, create the subfolders Ex2, Ex3, Ex4, and Ex5. Place the solution to each of the four exercises required for submission in the corresponding subfolder. Compress the folder Week 6 Lab, and place the resulting zipped folder into the Dropbox. Note that Exercises 2, 3, 4, and 5 require software development. Place in the corresponding folders only .java files. Do not submit the .class files or other files or folders that are generated by the IDE. Required Software
  • 29. Eclipse Access the software at https://lab.devry.edu . iLAB STEPS Exercise 1: Lecture Review—Binary Search Tree Back to Top Create a project using the classes BinarySearchTree, Node, and Main in Binary Search Tree. Compile the project, run it, and review the code that is given carefully. These programs test the code discussed in our lecture. Exercise 2: An Improved BST Class Back to Top Add the toString method to the class BinarySearchTree in Exercise 1. Note: The toString method returns a string representation of the object properties. By implementing toString, a BinarySearchTree object can be displayed in a simple way using System.out.print or System.out.println. For example, if bst is a BinarySearchTree object, it can be printed using System.out.println(bst). Exercise 3: Using a BST in an Application Back to Top
  • 30. Create a class SimpleBag that uses a binary search tree to store the bag items.The class should have the methods listed below. Create a Main class to test your SimpleBag class. SimpleBag(): default constructor; creates an empty bag booleanisEmpty(): determines whether the bag is empty void print(): prints the SimpleBag elements void clear(): removes all of the items from the bag void add(int item): adds an item to the bag int count(int item): counts the number of occurrences of items in the bag. Exercise 4: Recursion and Binary Trees Back to Top Add a recursive function getHeight to the BinarySearchTree class in Exercise 1 that returns the height of the tree. Create a Main class to test it. Exercise 5: Using Properties of BSTs Back to Top Add methods preorderDisplay and postorderDisplay to the BinarySearchTree class in Exercise 1 to print the items in the BST listed in preorder and postorder, respectively. Create a Main class to test them. ------------------------------
  • 31. ECET 370 Week 7 ilab Collections Framework (New Syllabus) For more course tutorials visit www.newtonhelp.com ECET 370 Week 7 ilab Collections Framework iLAB OVERVIEW Scenario and Summary The purpose of the lab exercises is to help the student acquire skills in developing programs that involve the use of the collections framework. Deliverables There are five exercises in this lab, although not all of them will be required for submission. Be sure to read the following instructions carefully. Exercise 1: No submission is required. Create a folder and name it Week 7 Lab. Inside this folder, create the subfolders Ex2, Ex3, Ex4, and Ex5. Place the solution to each of the four exercises required for submission in the corresponding subfolder. Compress the folder Week 7 Lab, and drop the resulting zipped folder into the Dropbox.
  • 32. Note that Exercises 2, 3, 4, and 5 require software development. Place only source files in the corresponding folders. Do not submit other types of files or folders that are generated by the IDE. Exercises 2 and 4 should be implemented using the Java programming language, and Exercises 3 and 5 should be implemented using the C++ programming language. Exercise 1 requires both. Required Software Eclipse Access the software at https://lab.devry.edu . Microsoft Visual Studio 2012 Access the software at https://lab.devry.edu . iLAB STEPS Exercise 1: Lecture Review—JCF and STL Back to Top Create seven projects, JCF array list, JCF linked list, JCF sort,JCF stack, STL doubly linked list, STL stack and queue, and STL vector, using the programs in: JCF array list JCF linked list
  • 33. JCF sort JCF stack STL doubly linked list STL stack and queue STL vector Compile the projects, run them, and review the code that is given carefully. These programs test the code discussed in our lecture. Exercise 2: Using the JCF ArrayList Back to Top Write a Java program to store 1,000 random numbers, each in the interval [0, 500], in a java.util.ArrayList object. Print the numbers. Exercise 3: Using the STL Vector Back to Top Write a C++ program to store the first 20 factorials: 1!, 2!, 3!, . . . , 20! in a vector object. Exercise 4: Developing an Application with JCF Back to Top Complete Project 2 at the end of Chapter 5 in our textbook: Write a Java program that uses a stack to test whether an input string is a palindrome.
  • 34. To implement the solution to this problem, use the stack data structure in JCF. Note that this exercise is a variation of Exercise 3 in the lab of Week 3. Exercise 5: Developing an Application with C++ STL Back to Top Complete Project 4 at the end of Chapter 10 in our textbook:Simulate a small airport with one runway. Airplanes waiting to take off join a queue on the ground. Planes waiting to land join a queue in the air. Only one plane can use the runway at any given time. All planes in the air must land before any plane can take off. To implement the solution to this problem, use the queue data structure in C++ STL. Note that this exercise is a variation of Exercise 6 in the lab of Week 3. ------------------------------ ECET 370 Week 7 Lab 7 Binary Trees For more course tutorials visit www.newtonhelp.com Full set of lab with working programs. Exercise 1: Lecture review: Binary Search Tree Create a project using the classes BinarySearchTree, Node, and Main in the DocSharing area
  • 35. labeled “The BST." Compile the project, run it, and review the code that is given carefully. These programs test the code discussed in our lecture. Exercise 2: An improved BST class Modify the class BinarySearchTree so that it contains the toString method, instead of the display method that was given originally. Exercise 3: Using a BST in an application Use a binary search tree to implement a dictionary that contains the keywords in the Java language. Test it. Note that you can use the programs from the previous exercises. For a list of the keywords in Java, visit http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.ht ml. Exercise 4: Recursion and Binary Trees Write a recursive algorithm that counts the nodes in a binary search tree. Exercise 5: Using properties of BSTs Write an algorithm getMax to find the maximum value stored in a binary search tree.