Questions
Please fill in the code where it says to implement Methods needed to implement include: insert,...

Please fill in the code where it says to implement

Methods needed to implement include: insert, find, remove, and toIndex

//

// STRINGTABLE.JAVA

// A hash table mapping Strings to their positions in the the pattern sequence

// You get to fill in the methods for this part.

//

public class StringTable {

  

private LinkedList<Record>[] buckets;

private int nBuckets;

//

// number of records currently stored in table --

// must be maintained by all operations

//

public int size;

  

  

//

// Create an empty table with nBuckets buckets

//

@SuppressWarnings("unchecked")

public StringTable(int nBuckets)

{

this.nBuckets = nBuckets;

buckets = new LinkedList[nBuckets];

// TODO - fill in the rest of this method to initialize your table

}

  

  

/**

   * insert - inserts a record to the StringTable

   *

   * @param r

   * @return true if the insertion was successful, or false if a

   * record with the same key is already present in the table.

   */

public boolean insert(Record r)

{

// TODO - implement this method

if() {

  

}

return false;

}

  

  

/**

   * find - finds the record with a key matching the input.

   *

   * @param key

   * @return the record matching this key, or null if it does not exist.

   */

public Record find(String key)

{

// TODO - implement this method

return null;

}

  

  

/**

   * remove - finds a record in the StringTable with the given key

   * and removes the record if it exists.

   *

   * @param key

   */

public void remove(String key)

{

// TODO - implement this method

}

  

/**

   * toIndex - convert a string's hashcode to a table index

   *

   * As part of your hashing computation, you need to convert the

   * hashcode of a key string (computed using the provided function

   * stringToHashCode) to a bucket index in the hash table.

   *

   * You should use a multiplicative hashing strategy to convert

   * hashcodes to indices. If you want to use the fixed-point

   * computation with bit shifts, you may assume that nBuckets is a

   * power of 2 and compute its log at construction time.

   * Otherwise, you can use the floating-point computation.

   */

private int toIndex(int hashcode)

{

// Fill in your own hash function here

return 0;

}

  

  

/**

   * stringToHashCode

   * Converts a String key into an integer that serves as input to

   * hash functions. This mapping is based on the idea of integer

   * multiplicative hashing, where we do multiplies for successive

   * characters of the key (adding in the position to distinguish

   * permutations of the key from each other).

   *

   * @param string to hash

   * @returns hashcode

   */

int stringToHashCode(String key)

{

int A = 1952786893;

int v = A;

for (int j = 0; j < key.length(); j++)

{

char c = key.charAt(j);

v = A * (v + (int) c + j) >> 16;

}

return v;

}

/**

   * Use this function to print out your table for debugging

   * purposes.

   */

public String toString()

{

StringBuilder sb = new StringBuilder();

for(int i = 0; i < nBuckets; i++)

{

sb.append(i+ " ");

if (buckets[i] == null)

{

sb.append("\n");

continue;

}

for (Record r : buckets[i])

{

sb.append(r.key + " ");

}

sb.append("\n");

}

return sb.toString();

}

}

In: Computer Science

ASSIGNMENT: Pick one of the topics below and discuss: 1: IT Project Management 2: Information Security...

ASSIGNMENT:

Pick one of the topics below and discuss:

1: IT Project Management

2: Information Security Management

In: Computer Science

Create a footer for web page using HTML,CSS,Javascript. The footer should contain 1.Back to top button...

Create a footer for web page using HTML,CSS,Javascript. The footer should contain

1.Back to top button

2.Random logo

3.Copyright content

In: Computer Science

Build a binary search tree with the following words. Insert them in an order so that...

Build a binary search tree with the following words. Insert them in an order so that the tree has as small a depth as possible. (Consider the insertion order of the words) Print the tree after,also, any, back, because, come, day, even, first, give, how, its, look, most, new, now, only, other, our, over, than, then, these, think, two, us, use, want, way, well, work.

C++

In: Computer Science

What is the status of the firewalld service on your system?

What is the status of the firewalld service on your system?

In: Computer Science

Which of the following is the most suitable for applications that need to have very fast...

Which of the following is the most suitable for applications that need to have very fast real time response?

Choose one of the following answers.

1. Fog computing

2. Ubiquitous computing

3. Edge computing

4. Cloud computing

In: Computer Science

1. For each of the following statements find an equivalent statement in conjunctive normal form. Show...

1. For each of the following statements find an equivalent statement in conjunctive normal form. Show the proof and truth table.

a) ¬(A ∨ B)

b) ¬(A ∧ B)

c) A ∨ (B ∧ C)

2. Is the following implication true or false? And if false, give an example that shows that it is false.

If S1 ∈ S2 and S2 ∈ S3, then S1 ∈ S3

In: Computer Science

a. Many computational methods involve working with large matrices. If your computer has 8 GB of...

a. Many computational methods involve working with large matrices. If your computer has 8 GB of RAM, theoretically, what is the largest square (n x n) matrix of doubles your computer can hold in memory? What if you instead are storing variables of type single or int8?

b. Try creating such a (n x n) matrix of double values. What happens? What is the largest (n x n) matrix you can actually store on your machine?

In: Computer Science

Exercise: Change Orb Location ------------------------- ### Description In this series of exercises, you will create functions...

Exercise: Change Orb Location
-------------------------

### Description

In this series of exercises, you will create functions
to create, modify and examine dictionaries that
represent information about a memory orb. Memory
orbs have three important pieces of information:
The `emotion` that created the memory, the `location`
the memory is stored, and the `data` which is the
information in the memory.

For this exercise, you will create a function that
will change the value of the `location` key in a
dictionary.

### Files

* `orbfunctions.py` : set of functions to work with memory orbs.

### Function Name

`move_orb`

### Parameters

* `orb` : a dictionary
* `new_location` : a string, the new value for `location`

### Action

Changes the value associated with the key `location`.

### Return Value

The modified dictionary, `orb`.

def create_orb(emotion, location, data):
dict = {
"emotion":emotion,
"location":location,
"data":data
}
return dict

def orb_get_emotion(orb):
return orb["emotion"]

def change_orb_emotion(orb, new_emotion):
orb.update({"emotion":new_emotion})
return orb
def orb_get_location(orb):
if orb.get('location'):
return orb.get('location')
else:
return None
  
def move_orb(orb,location):
if

In: Computer Science

Do research to determine the current status of PTC deployment. Summarize your findings in a couple...

Do research to determine the current status of PTC deployment. Summarize your findings in a couple of paragraphs.

In: Computer Science

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and...

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:

Min miles: -10
Max miles: 40

import java.util.Scanner;

public class ArraysKeyValue {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
final int NUM_ROWS = 2;
final int NUM_COLS = 2;
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS];
int i;
int j;
int maxMiles; // Assign with first element in milesTracker before loop
int minMiles; // Assign with first element in milesTracker before loop

for (i = 0; i < milesTracker.length; i++){
for (j = 0; j < milesTracker[i].length; j++){
milesTracker[i][j] = scnr.nextInt();
}
}

/* Your solution goes here */

System.out.println("Min miles: " + minMiles);
System.out.println("Max miles: " + maxMiles);
}
}

In: Computer Science

Python Coding: Working with Conditions and Dictionaries. 1. Create three dictionaries (student_1, student_2, student_3). 2. In...

Python Coding:

Working with Conditions and Dictionaries.

1. Create three dictionaries (student_1, student_2, student_3).

2. In each student dictionary have a key-value for first_name, last_name, and an id number (6 digit), and a current_course. The values assigned to each of these keys is your choice.

3. Also each student will have in their dictionary a list for grades. You will need to add 3 grade values into the list.

4. Provide the student with a message about each assignment grade based on the grade value.

For each of the grades for each assignment:

Provide a 90-100 grade message. My example used 'Congratulations'

Provide a 80-89 grade message. My example used 'Good job!'

Provide a 70-79 grade message. My example used 'You passed!'

Provide a 60-69 grade message. My example used 'Bad news, below average'

59 or lower grade message would be 'Failed.'

For each grade:

'You have made a {grade value} on assignment {assignment number}.

5. Print out each student's data as shown in the example output below:

Name: Smith, John   

Id: 646562   

Course: ITSE 1359

Grades: 86, 74, 94

Good job!

You have made a 86 on assignment 1.

You passed!

You have made a 74 on assignment 2.

Congratulations

You have made a 94 on assignment 3.

In: Computer Science

Consider the following class definition: class circle                                  &nb

  • Consider the following class definition:

    class circle                                                       class cylinder: public circle
    {                                                                      {
    public:                                                             public:
    void print() const;                                           void print() const;
    void setRadius(double);                                  void setHeight(double);
    void setCenter(double, double);                     double getHeight();
    void getCenter(double&, double&);               double volume();
    double getRadius();                                        double area();
    double area(); circle();                                     cylinder();
    circle(double, double, double);                       cylinder(double, double,
    double, double);
    private:                                                private:
    double xCoordinate;                                       double height;
    double yCoordinate;                         }
    double radius;
    }

    Suppose that you have the declaration:
    cylinder newCylinder;

  1. Write the definitions of the member functions of the classes circle and cylinder. Identify the member functions of the class cylinder that overrides the member functions of the class circle.

In: Computer Science

You are in charge of the computers at a large inner-city library. Most of the people...

You are in charge of the computers at a large inner-city library. Most of the people who live in the neighborhood do not have a computer at home. They go to the library when they want to access the Internet. About two-thirds of the people surfing the Web on the library’s computers are adults. You have been requested to install filtering software that would block Websites containing various kinds of material deemed inappropriate for children. You have observed this software in action and know that it also blocks many sites that adults might legitimately want to visit. How should you respond to the request to install filtering software?

In: Computer Science

If you were to explain why software engineering teams have different ethical responsibilities than other computing...

If you were to explain why software engineering teams have different ethical responsibilities than other computing professionals – what would you argue? Explain why or why not you agree with this statement. (2.5 points)

In: Computer Science