Lab3
.html
keyboard_arrow_up
School
Pennsylvania State University *
*We aren’t endorsed by this school
Course
410
Subject
Computer Science
Date
Feb 20, 2024
Type
html
Pages
5
Uploaded by MateWasp883
Instructor: Professor Romit Maulik
¶
TAs: Haomiao Ni and Songtao Liu
¶
Lab 3: Hashtag Counting and Spark-
submit in Cluster Mode
¶
The goals of this lab are for you to be able to
¶
- Use the RDD transformations filter
and sortBy
.
¶
- Compute hashtag counts for an input data file containing tweets.
¶
- Modify PySpark code for local mode into PySpark code for cluster mode.
¶
- Request a cluster from ICDS, and run spark-submit in the cluster mode for a big dataset.
¶
- Obtain run-time performance for a choice on the number of output
partitions for reduceByKey.
¶
- Apply the obove to compute hashtag counts for tweets related to Boston Marathon Bombing (gathered on April 17, 2013, two days after the domestic terrorist attack).
¶
Total Number of Exercises: 5
¶
•
Exercise 1: 5 points •
Exercise 2: 10 points •
Exercise 3: 10 points •
Exercise 4: 15 points •
Exercise 5: 10 points Total Points: 50 points
¶
Data for Lab 3
¶
•
sampled_4_17_tweets.csv : A random sampled of a small set of tweets regarding Boston Marathon Bombing on April 17, 2013. This data is used in the local mode.
•
BMB_4_17_tweets.csv : The entire set of tweets regarding Boston Marathon Bombing on April 17, 2013. This data is used in the cluster mode. •
Like Lab2, download the data from Canvas into a directory for the lab (e.g., Lab3) under your home directory. Items to submit for Lab 3
¶
•
Completed Jupyter Notebook (HTML format) •
.py file used for cluster mode •
log file for a successful run in the cluster mode •
a screen shot of the ls -al
command in the output directory for a successful run
in the cluster mode.
Due: 11.59 PM, Sept 10, 2023, 5 bonus points if you submit by 11.59 PM, Sept 8, 2023
¶
Like Lab 2, the first thing we need to do in each Jupyter Notebook running pyspark is to import pyspark first.
¶
In [1]:
import pyspark
In [2]:
from pyspark import SparkContext
Like Lab 2, ww create a Spark Context object.
¶
•
Note: We use "local" as the master parameter for SparkContext
in this notebook
so that we can run and debug it in ICDS Jupyter Server. However, we need to remove "master="local",
later when you convert this notebook into a .py file for running it in the cluster mode. In [3]:
sc=SparkContext(appName="Lab3")
sc
Out[3]:
SparkContext
Spark UI
Version v3.4.1
Master local
AppName Lab3
Exercise 1 (5 points) Add your name below
¶
Answer for Exercise 1
¶
•
Your Name: Ruthvik Uttarala Exercise 2 (10 points)
¶
Complete the path and run the code below to read the file "sampled_4_17_tweets.csv" from your Lab3 directory.
¶
For cluster mode execution - change this path to "BMB_4_17_tweets.csv" for a big data cluster job
¶
In [4]:
tweets_RDD = sc.textFile("/storage/home/rpu5040/Lab3/BMB_4_17_tweets.csv")
tweets_RDD
Out[4]:
/storage/home/rpu5040/Lab3/sampled_4_17_tweets.csv MapPartitionsRDD[1] at textFile at NativeMethodAccessorImpl.java:0
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Poropertu f Hash Fumctons: 1. Pre- umage Resistamce
2. Second - Pre image
arrow_forward
Create hash table and an appropriate hash function for use in storage and retrieval of character data. You will vary the size of the table and count the number of collisions that occurs with each table.
Includes the following basic methods:
init - mark all positions of the table as empty.
hashMe - calculate the hash index based on properties of the data.
getNextOpenPosition - in the event of a collision, search table for the next available piece of memory.
showTable - prints out occupied positions in table.
rehash - when collisions become frequent, allocate a new table with a larger size and then rehash the data from the current table into the new table using a hash function that is modified to take the new table's size into account.
The Hashing function is: hashKey = function of data characteristics
a) Create a hash table. Use your table to “sort” a list of names. A list of test names are below:
joe bob harry mary brian tom jerry bullwinkle pam ellis dale bill barrack george gertrude…
arrow_forward
import numpy as npimport matplotlib.pyplot as pltfrom sklearn.cluster import KMeansfrom sklearn.cluster import DBSCAN from sklearn.datasets import make_blobs
n_samples = [750,750,750]
cluster_std = 1
random_state = 200
X, Y_true = make_blobs(n_samples=n_samples, random_state=random_state, cluster_std=cluster_std)
plt.scatter(X[:, 0], X[:, 1], marker='.', c=Y_true)
#DBSCAN model, setting up required parameters eps = 0.4min_Samples = 10db = DBSCAN(eps=eps, min_samples=min_Samples).fit(X)labels = db.labels_labels
# To count number of clusters in labels, ignoring noise if present.n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)n_noise_ = list(labels).count(-1)
print('Estimated number of clusters: %d' % n_clusters_)print('Estimated number of noise points: %d' % n_noise_)
# Plot result# Use black to label noise points.unique_labels = set(labels)colors = plt.cm.Spectral(np.linspace(0, 1, len(unique_labels)))
core_samples_mask = np.zeros_like(db.labels_,…
arrow_forward
I have this code but keep getting illegal character: '\u0000'
arrow_forward
JavaScript
The jQuery "post" method that we used in this course to enable "round-trip" dialog with the node.js server has the form:
$.post("/", x, y);
Describe the type and purpose of the x and y parameters.
arrow_forward
Direction: Continue the attached code below. It can only insert
a value to a linkedlist. Your goal is to add new functionality to
the linkedlist. You may only choose 3 more functions:
1. getValue - this function should be able to display a node by
specifying its position(index).
2. clear-resets the linkedlist by assigning null to head.
3. insertNewHead this function can be used to assign a new
head to the linkedlist
4. insert At this function can be used to insert a node to a
specific location.
5. display All this function will display all nodes
arrow_forward
Direction: Continue the attached code below. It can only insert a value to a linkedlist. Your goal is to add new functionality to the linkedlist. You may only choose 3 more functions:
1. getValue - this function should be able to display a node by specifying its position (index).
2. clear - resets the linkedlist by assigning null to head.
3. insertNewHead this function can be used to assign a new head to the linkedlist
4. insertAt - this function can be used to insert a node to a specific location.
5. displayAll this function will display all nodes
import java.util.Scanner;
class MainLL
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
SinglyLL sll= new SinglyLL();
String msg = "Enter an action: [1] Insert, [2]Get an element, [3] clear, [0] Exit";
System.out.println(msg);
int choice = sc.nextInt();
while(choice != 0) {
switch(choice) {
case 1: System.out.println("Enter a value:");
sll.insert(sc.next());
System.out.println("Successfully added a node!\n"…
arrow_forward
Direction: Continue the attached code below. It can only insert a value to a linkedlist.
Your goal is to add new functionality to the linkedlist. You may only choose 3 more functions:
1. getValue - this function should be able to display a node by specifying its position (index).
2. clear - resets the linkedlist by assigning null to head.
3. insertNewHead
this function can be used to assign a new head to the linkedlist
4. insertAt - this function can be used to insert a node to a specific location.
5. displayAll this function will display all nodes
import java.util.Scanner;
class MainLL
{
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
SinglyLL sll= new SinglyLL();
String msg = "Enter an action: [1] Insert, [2]Get an element, [3] clear, [0] Exit";
System.out.println(msg);
int choice = sc.nextInt();
while(choice != 0) {
switch(choice) {
case 1: System.out.println("Enter a value:");
System.out.println("Successfully added a node!\n" + msg);
default:…
arrow_forward
Identify the difference between blocking and non-blocking assignments. Explain the situation
when you would be using them in your Verilog code.
arrow_forward
Hash Function
arrow_forward
Software Requirements:
NetBeans IDE
Java Development Kit (JDK) 8
Python 3.7 or higher
Procedure:
1. Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark)
2. Using NetBeans, create a Java project named StudentList. Set the project location to your own
folder.
3. Import Scanner, Map, and HashMap from the java.util package.
4. Create an empty hash map named students.
5. The output shall:
5.1. Ask three (3) of your classmates to enter their student number (key) and first name (value).
5.2. Display the keys and values of the map.
5.3. Delete the mapping of the third entry.
5.4. Enter your student number and first name. This would be the new third entry.
5.5. Display the entries in separate lines.
6. Create a Python script that meets the same specifications. Feel free to use lists to store input.
7. Save the script as student_list.py to your folder.
Sample output:
Enter student number 1: 2018-0004
Enter first name 1: Mark
Enter student number 2: 2018-0017
Enter first…
arrow_forward
Insert into a hash table with a maximum size of 10, the following keywords- apple, grape, orange, pineapple
Hash function use Division . methodIf there is a collision handling with Linear Probing
Create the final result hash table
arrow_forward
Computer Science
We know that JavaScript objects can be stored as redis hashes. We can use a JavaScript client and send data to the redis server. Write JavaScript code to insert a JavaScript object having keys first_name, last_name, course_id, section, year, term as a hash in Redis. Also , Write code to retrieve first_name and last_name from the above-created redis hash.
arrow_forward
LinkedLists are used to hold all of our hash map data because of the shoddy way the map was originally built. This significantly reduces a hash map's efficiency.
arrow_forward
Direction: Continue the attached code below. It can
only insert a value to a linkedlist. Your goal is to
add new functionality to the linkedlist. You may
only choose 3 more functions:
1. getValue - this function should be able to display
a node by specifying its position(index).
2. clear - resets the linkedlist by assigning null to
head.
3. insertſewHead - this function can be used to
assign a new head to the linkedlist
4. insertAt this function can be used to insert a
node to a specific location.
S. displayAll this function will display all nodes
import java.util.Scanner;
class Mainll
{
public static void main(String() args) {
Scanner sc = new
Scanner(System.in);
Singlyll sll = new SinglyLL();
String msg = "Enter an action: (1)Insert
(2)Get an element, (3) clear, (0)Exit";
casel:
System.out.println("Enter a value:");
sll.insert(sc.next());
System.out.println("Successfully added a node!\n"
+ msg):
System.out.println(msg);
int choice = sc.nextInt();
while(choice != 0) {
switch(choice) {…
arrow_forward
Due to the poor design of our hashmap, all of the keys and values are stored in the same place (a LinkedList). This eliminates one of the main advantages of using a hash map.
arrow_forward
BbPython Online - 2022 Fall ET 574 X
= CO
Bing
Links
H
Remaining Time: 1 hour, 42 minutes, 51 seconds.
Question Completion Status:
P
Online Python - IDE, Editor, Con X Bb Take Test: ET574 Coding Final Ex
bbhosted.cuny.edu/webapps/assessment/take/launch.jsp?course_assessment_id=_2271631_1&course_ic
QUESTION 7
Implement the following:
1) Write a function randFive() with one parameter n.
2) randFive() create five random integers in the range (1, n) inclusive.
3) Five numbers should be stored in a list as the return value.
Call the function, randFive() with the argument, 100.
5) Print the result of the function call.
randFive() can generate any five numbers.
Make sure to precisely match the output format below.
Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course).
Example Output
[1, 20, 9, 84, 46]
For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac).
BIUS Paragraph V Arial
0
P
QUESTION 8
4
Click Save and Submit to save and…
arrow_forward
The purpose of this project is to assess your ability to:
Implement a hash table
Utilize a hash table to efficiently locate data
Analyze and compare algorithms for efficiency using Big-O notation
For this project, you will implement a hash table and use it to store words in a large text file. Your hash table should use chaining for collision resolution. You may design any hash function you wish.
Your program will read a file and insert each word into a hash table. Once the table is populated, allow the user to enter words to search for. For each word entered, your program should report the number of elements inspected and whether or not the word was located.
Provide an analysis of your insert and search algorithms using Big-O notation. Be sure to provide justification for your claims.
arrow_forward
I need help with this question and I keep getting this error line -3: error: illegal character: '\'
X438: LinkedList - Create a LinkedList
Complete a custom singly-linked LinkedList to hold generic objects. The list will use nodes called LinearNodes, which have methods getNext, setNext, getElem, and setElem. It includes methods for adding an element to a specific index or simply to the end, removing or replacing elements at specific indexes, peeking at an element without removing it, and returning the size of the list. NEEDS TESTING
Code:
private class LinkedList<E> {private int size;private LinearNode<E> first;private LinearNode<E> last;public LinkedList() {}public void add(E elem) {}public void add(E elem, int index) {}public E remove(int index) {}public E peek(int index) {}public E replace(int index, E elem) {}public int size() {}}
arrow_forward
https://en.wikipedia.org/wiki/Greenhouse_gas
Webscraping class:
class WebScraping:def __init__(self,url):self.url = urlself.response = requests.get(self.url)self.soup = BeautifulSoup(self.response.text, 'html.parser')def extract_data(self):data = defaultdict(list)table = self.soup.find('table', {'class': 'wikitable sortable'})rows = table.find_all('tr')[1:]for row in rows:cols = row.find_all('td')data['Country Name'].append(cols[0].text.strip())data['1980'].append(cols[1].text.strip())data['2018'].append(cols[2].text.strip())return data
question #1
class GreenhouseGasData(NamedTuple):
Gas: str
Pre_1750: float
Recent: float
Absolute_increase_since_1750: float
Percentage_increase_since_1750: float
class GreenhouseGasCollection:
def __init__(self, data):
self.data = data
def __repr__(self):
return str(self.data)
def sort_by(self, column):
if column not in GreenhouseGasData._fields:
raise…
arrow_forward
Difference between Cache and HashMap.
arrow_forward
%config IPCompleter.greedy=True%env OPENBLAS_NUM_THREADS=1import pandas as pdimport implicitfrom sklearn.model_selection import train_test_splitimport scipy.sparse as spsimport numpy as npimport matplotlib.pyplot as pltimport tqdmfrom collections import defaultdict
! ls -lh yandex_music
! head -n 5 yandex_music/artists.jsonl
! head -n 5 yandex_music/events.csv
artists = pd.read_json("yandex_music/artists.jsonl", orient='records', lines=True)
events = pd.read_csv("yandex_music/events.csv")
# most popular artists( events .merge(artists)[['artistName', 'plays']] .groupby("artistName").sum() .sort_values('plays', ascending=False) .head(10))
train, test = train_test_split(events, test_size=0.05, random_state=0)
# prepare matrix for implicit library (https://implicit.readthedocs.io/en/latest/models.html)# item_user (sparse csr_matrix) of item/user/confidence# csc_matrix((data, (row_ind, col_ind)), [shape=(M, N)])# where ``data``, ``row_ind`` and ``col_ind`` satisfy the#…
arrow_forward
I've wrote a script to find the top three features for a random forest, but it is not work.please assist to fix the below code.
#Import scikit-learn dataset libraryfrom sklearn import datasets#Load datasetiris = datasets.load_iris()# Creating a DataFrame of given iris dataset.import pandas as pdimport numpy as npdata=pd.DataFrame({'sepal length':iris.data[:,0],'sepal width':iris.data[:,1],'petal length':iris.data[:,2],'petal width':iris.data[:,3],'species':iris.target})iris['target_names']print(data.head())# Import train_test_split functionfrom sklearn.model_selection import train_test_splitX=data[['sepal length', 'sepal width', 'petal length', 'petal width']] # Featuresy=data['species'] # Labels# Split dataset into training set and test setX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)#Import Random Forest Modelfrom sklearn.ensemble import RandomForestClassifier#Create a Gaussian Classifierrf=RandomForestClassifier(n_estimators=100)#Train the model using the…
arrow_forward
The data that makes up our hash map is all kept in a single LinkedList container due to the way the map was designed. This significantly reduces a hash map's efficiency.
The data that makes up our hash map is all kept in a single LinkedList container due to the way the map was designed. This significantly reduces a hash map's efficiency.
arrow_forward
Password Cracking
Each student should be able to access* one PassXX.hash file. This file contains 4 unsalted md5 password hashes (md5 is commonly used for hashing passwords, though it is a bit weak for modern use. It is very important to salt passwords before hashing them, since leaving them unsalted makes them easier to crack. However, many sites fail to do this).
Your assignment is to use Hashcat (or another password cracking or password "recovery" tool) to retrieve the original passwords from the hashes, and submit the password/hash pairs.
Each set of hashes contains 1 very easy password and 3 slightly challenging passwords of differing format.
Link to hashcat: https://hashcat.net/hashcat/
Note: You will also need one or more dictionaries to perform a dictionary attack.
*access: Files are accessible based on your last name. You should see a large number of files that are not accessible due to your account having a wrong last name, and one file that is accessible that lacks…
arrow_forward
Please help me with this
Please fix the full code: this code is supposed to work in a web browser (Client_side.js)
const url = "http://localhost:3000/document";
let undoStack = [];let redoStack = [];
function sendDataToServer(data) { fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ content: data }) }) .then(response => response.json()) .then(data => console.log('Success:', data)) .catch((error) => console.error('Error:', error));}
function formatText(command) { document.execCommand(command, false, null);}
function changeColor() { const color = prompt("Enter text color code:"); document.execCommand("foreColor", false, color);}
function changeFont() { const font = prompt("Enter font:"); document.execCommand("fontName", false, font);}
function changeFontSize() { const size = prompt("Enter font size:"); document.execCommand("fontSize", false, size);}…
arrow_forward
Given 10,000 URL visit records, design a hashing-based method so that we can
quickly retrieve URLS that are most frequently visited. Describe your design
concerns in a txt file. Like how you would design the data structure and how
you plan to process input and generate output.
For instance, your input is a file containing 10,000 rows, where each row
contains: URLaddress,visit_timestamp
Note that one URLaddress can be visited multiple times.
arrow_forward
You can use URLs to access information on the Web from Java programmes. (uniform resource locators). Programmers at MindSlave Software would like to manage a potentially sizable bookmark list of frequently visited URLs for their new NetPotato browser. They would find it most helpful if they had unrestricted access to the list's preserved values. Is a List the right kind of data structure? If not, why not? (Hint:
arrow_forward
Our hash map data are all stored in a single LinkedList because of the sloppy way the map was built. As a result, a hash map loses some of its utility.
arrow_forward
Downloads/
E ID-21201491;name-Nuzhat Taba: X
+
English
O localhost:8888/notebooks/Downloads/ID-21201491%3Bname-Nuzhat%20Tabassum%3B%20sec%20-%2017%3B%20CSE110%3B%20Lab%20assignment%2004.ipynb
Cjupyter ID-21201491;name-Nuzhat Tabassum; sec - 17; CSE110;... Last Checkpoint: Last Tuesday at 10:45 PM (unsaved changes)
Logout
File
Edit
View
Insert
Cell
Kernel
Widgets
Help
Trusted
Python 3 O
+
> Run
Code
=========
===== ===== ==
In [7]: #to do
Task 13
Write a Python program that reads 5 numbers into a list and prints the smallest and largest number and their locations in the list. [You are not allowed to use
the max(), min(), sort(), sorted() functions here]
Hint: You may assume the first input to be the largest value initially and the largest value's location to be 0. Similarly, you can assume the first input to be the
smallest value initially and the smallest value's location to be 0.
Note: You may need to be careful while printing the output. Depending on your code, you might need data…
arrow_forward
java
Draw a picture of the HashSet created by the data shown below. Assume the HashSet (1) has an initial size of 11, (2) uses separate chaining, and (3) inserts new nodes at the start (not end) of the chain. -4, 2, 18, 23, -15, 47, 87, 2032, 5393, 2, 53432
arrow_forward
The data is maintained in a single container called a LinkedList because of the way our hash map was built. As a result, a hash map's usefulness is reduced.
arrow_forward
A direct access hash table has items 51, 53, 54, and 56. The table must have a minimum of _____ buckets.
a.
4
b.
5
c.
56
d.
57
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- Poropertu f Hash Fumctons: 1. Pre- umage Resistamce 2. Second - Pre imagearrow_forwardCreate hash table and an appropriate hash function for use in storage and retrieval of character data. You will vary the size of the table and count the number of collisions that occurs with each table. Includes the following basic methods: init - mark all positions of the table as empty. hashMe - calculate the hash index based on properties of the data. getNextOpenPosition - in the event of a collision, search table for the next available piece of memory. showTable - prints out occupied positions in table. rehash - when collisions become frequent, allocate a new table with a larger size and then rehash the data from the current table into the new table using a hash function that is modified to take the new table's size into account. The Hashing function is: hashKey = function of data characteristics a) Create a hash table. Use your table to “sort” a list of names. A list of test names are below: joe bob harry mary brian tom jerry bullwinkle pam ellis dale bill barrack george gertrude…arrow_forwardimport numpy as npimport matplotlib.pyplot as pltfrom sklearn.cluster import KMeansfrom sklearn.cluster import DBSCAN from sklearn.datasets import make_blobs n_samples = [750,750,750] cluster_std = 1 random_state = 200 X, Y_true = make_blobs(n_samples=n_samples, random_state=random_state, cluster_std=cluster_std) plt.scatter(X[:, 0], X[:, 1], marker='.', c=Y_true) #DBSCAN model, setting up required parameters eps = 0.4min_Samples = 10db = DBSCAN(eps=eps, min_samples=min_Samples).fit(X)labels = db.labels_labels # To count number of clusters in labels, ignoring noise if present.n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)n_noise_ = list(labels).count(-1) print('Estimated number of clusters: %d' % n_clusters_)print('Estimated number of noise points: %d' % n_noise_) # Plot result# Use black to label noise points.unique_labels = set(labels)colors = plt.cm.Spectral(np.linspace(0, 1, len(unique_labels))) core_samples_mask = np.zeros_like(db.labels_,…arrow_forward
- I have this code but keep getting illegal character: '\u0000'arrow_forwardJavaScript The jQuery "post" method that we used in this course to enable "round-trip" dialog with the node.js server has the form: $.post("/", x, y); Describe the type and purpose of the x and y parameters.arrow_forwardDirection: Continue the attached code below. It can only insert a value to a linkedlist. Your goal is to add new functionality to the linkedlist. You may only choose 3 more functions: 1. getValue - this function should be able to display a node by specifying its position(index). 2. clear-resets the linkedlist by assigning null to head. 3. insertNewHead this function can be used to assign a new head to the linkedlist 4. insert At this function can be used to insert a node to a specific location. 5. display All this function will display all nodesarrow_forward
- Direction: Continue the attached code below. It can only insert a value to a linkedlist. Your goal is to add new functionality to the linkedlist. You may only choose 3 more functions: 1. getValue - this function should be able to display a node by specifying its position (index). 2. clear - resets the linkedlist by assigning null to head. 3. insertNewHead this function can be used to assign a new head to the linkedlist 4. insertAt - this function can be used to insert a node to a specific location. 5. displayAll this function will display all nodes import java.util.Scanner; class MainLL { public static void main(String[] args) { Scanner sc = new Scanner(System.in); SinglyLL sll= new SinglyLL(); String msg = "Enter an action: [1] Insert, [2]Get an element, [3] clear, [0] Exit"; System.out.println(msg); int choice = sc.nextInt(); while(choice != 0) { switch(choice) { case 1: System.out.println("Enter a value:"); sll.insert(sc.next()); System.out.println("Successfully added a node!\n"…arrow_forwardDirection: Continue the attached code below. It can only insert a value to a linkedlist. Your goal is to add new functionality to the linkedlist. You may only choose 3 more functions: 1. getValue - this function should be able to display a node by specifying its position (index). 2. clear - resets the linkedlist by assigning null to head. 3. insertNewHead this function can be used to assign a new head to the linkedlist 4. insertAt - this function can be used to insert a node to a specific location. 5. displayAll this function will display all nodes import java.util.Scanner; class MainLL { } public static void main(String[] args) { Scanner sc = new Scanner(System.in); SinglyLL sll= new SinglyLL(); String msg = "Enter an action: [1] Insert, [2]Get an element, [3] clear, [0] Exit"; System.out.println(msg); int choice = sc.nextInt(); while(choice != 0) { switch(choice) { case 1: System.out.println("Enter a value:"); System.out.println("Successfully added a node!\n" + msg); default:…arrow_forwardIdentify the difference between blocking and non-blocking assignments. Explain the situation when you would be using them in your Verilog code.arrow_forward
- Hash Functionarrow_forwardSoftware Requirements: NetBeans IDE Java Development Kit (JDK) 8 Python 3.7 or higher Procedure: 1. Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark) 2. Using NetBeans, create a Java project named StudentList. Set the project location to your own folder. 3. Import Scanner, Map, and HashMap from the java.util package. 4. Create an empty hash map named students. 5. The output shall: 5.1. Ask three (3) of your classmates to enter their student number (key) and first name (value). 5.2. Display the keys and values of the map. 5.3. Delete the mapping of the third entry. 5.4. Enter your student number and first name. This would be the new third entry. 5.5. Display the entries in separate lines. 6. Create a Python script that meets the same specifications. Feel free to use lists to store input. 7. Save the script as student_list.py to your folder. Sample output: Enter student number 1: 2018-0004 Enter first name 1: Mark Enter student number 2: 2018-0017 Enter first…arrow_forwardInsert into a hash table with a maximum size of 10, the following keywords- apple, grape, orange, pineapple Hash function use Division . methodIf there is a collision handling with Linear Probing Create the final result hash tablearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education