Create a project using the arraylist class

Assignment Help Data Structure & Algorithms
Reference no: EM131380860

Lab Assignment: Data Structures and Algorithms

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.

Exercise 1: Review of the Lecture Content

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

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

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

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?

Reference no: EM131380860

Questions Cloud

Discuss the possible shortcomings of secondary data : Discuss the possible shortcomings of secondary data.- Why would a firm collect primary data in its international marketing research?
Manipulate c character strings which are simply arrays : In this exercise, you will manipulate C character strings, which are simply arrays of characters that are terminated by the ASCII NULL character (0x00, '\0').
Compare the use of telephone surveys in the united states : How is international market research affected by differences in language?- Compare the use of telephone surveys in the United States and in Egypt.
What were the industries and countries against : What were the industries and countries against which the United States filed antidumping actions last year?- Where would it be most difficult to conduct business due to a high degree of corruption?
Create a project using the arraylist class : 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.
Sustainability portfolio into the companys strategy : Examine the possible advantages and difficulties in integrating your sustainability portfolio into the company's strategy - design a sustainability plan for that company - If the company already has a clear sustainability portfolio, analyse it accor..
Discuss difference between a proactive and a reactive firm : Discuss the difference between a proactive and a reactive firm.- Discuss the impact of the Internet and e-commerce in making a firm global.
What kind of investment is most beneficial to a country : Explain the difference between franchising, licensing, and foreign direct investment, in terms of ownership, control, and risk.
Write an appropriate signature comment for order-price : CS 111- Write an appropriate signature comment for order-price. How many and what type of expressions should such a function expect, to be able to return such a perimeter?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Describe the jsp life cycle

Draw a diagram of the various events and transformations. Describe how you might implement logging in as used in the workshops using the session mechanism explaining what Java classes are involved and using code snippets.

  Chinese remainder theory

For RSA signature, let p=17 and q=43. Design a digital signature for the message m=161, where the hashing function is the identity function and the computation at the signer's side is performed through the Chinese Remainder Theory.

  Draw flowchart to print average for each student

Draw a flowchart to print the average for each student in a class. Input. Input consists of student records each containing a student's name(STUDENT-NAME), score for first test(TEST), score for second test(TEST2), and score for third test(TEST3)..

  Write a program that creates an array of random integers

Write a program that creates an array of 100 random integers in the range 1 to 200 and then, using the sequential search, searches the array 100 times using randomly generated targets in the same range.

  A program that performs depth first search in a graph

a program that performs Depth First Search in a graph

  Create program algorithm in pseudocode to store quiz grades

The elementary school for which you are doing development work has asked you to create a program algorithm in pseudocode to store quiz grades for the students of a class

  Implement the insertion sort algorithm for sorting an array

Implement the Insertion Sort algorithm for sorting an array of n elements. In this algorithm, the main loop index i runs from 1 to n-1. On the ith iteration, the element a[i] is "inserted" into its correct position among the subarray a[0..i].

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  How do i created the pseudocode

Using the UML diagram and variable list , create Pseudocode for the program.

  Write a breadth-?rst search algorithm

Write an algorithm to classify the edges of a directed graph G into the four categories: tree edge, back edge, forward edge and cross edge (de?ned in De?nition 7.14, pages 342-343).

  The provided code reads two sequences of numbers

The provided code reads two sequences of numbers. In this task, you are asked to write a function to insert these numbers into two separate doubly linked lists so that the data are in ascending order

  Question about arrays, vector and stl

Suppose if x denotes the mean of a sequence of numbers x1, x2,.....xn, variance is the average of the squares of the deviations of numbers from the mean.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd