You are to write a complete java class using threads and a tree of integers. you should have five threads 1. Thread randomly adding integer value to the tree 2. Thread randomly deleting values from the tree. 3. Thread that displays the tree in LNR order. 4.Thread that determines the current maximum value 5. Thread that determines the current minimum value
Q: A hash function takes an item and makes it into a number. A hash code is the number computed by a…
A: GIVEN:
Q: Roni and Rajesh love to play a rope-based game. The game is as follows. At first, Tracy writes a…
A: Algorithm: First input contains a single integer T, the number of test cases. Then the second line…
Q: package DataStructures; import ADTs.StackADT; import Exceptions.EmptyCollectionException; /** * *…
A: Actually, program is an executable software that runs on a computer.
Q: Consider the BadReaderWriter.java program attached with this homework. The program has three…
A: According to the infromation given:- we have to BadReaderWriter.java. It had 3 threads (reader,…
Q: 20 25 10 10 20 22 25 27 How many internal nodes will there be after we delete 10?
A: We are given a B+ tree and we are going to remove node 10 from it. Then we will find out the number…
Q: 1. Using your preferred IDE or this online IDE, create a Java stack consisting of four (4) book…
A: Step 1 Introduction Input 4 Strings and then pop each element and push to queue Finally print the…
Q: You’ve launched a thread, but want to know when it actually starts running. coorect pls in py
A: Question:- You’ve launched a thread, but want to know when it actually starts running. coorect pls…
Q: Write a program that creates three threads. The first thread will ask the user to enter a string,…
A: Given requirement, Write a program that creates three threads. The first thread will ask the user to…
Q: Java: Which operation is not supported in constant time by a double‐ended queue (deque)? Multiple…
A: Answer :-- option B Access and deletion of minimum item Reason :-- because every time position of…
Q: Rewrite method inserthelp() to take advantage of the modified BSTNode in which a pointer can be…
A: Actually, program is a executable software that runs on a computer.
Q: Q13. Which of the following types of linked lists is faster when deleting a node? Singly Linked List…
A: 1. Singly linked list means the starting and ending nodes are not connected. Circular linked list…
Q: ListQueue Node Node Node front- next data - "Thome" next nul1 data - "Jones" next- rear C size = 3…
A: Queue is a data structure that works on FIFO principle that is first in first out.
Q: Write a Java program that creates a new thread called PrintEven, that prints the Odd numbers between…
A: import java.util.Scanner; class PrintEven extends Thread{ //PrintEven thread…
Q: Assignment2: Analyse the case study given in chapter 4 stack Answer the following questions from the…
A: The different class names with class keyword:-
Q: Which of the following is designed to give efficient access to data in secondary storage such as a…
A: A heap structure developed for secondary storage is suggested that tries to make the best use of the…
Q: Implement a class that checks whether a given number is a prime number or not using both the Thread…
A: The solution code for the above given problem has been provided below - For both of the solutions…
Q: Write a program that creates three threads in Python. The first thread will ask the user to enter a…
A: Given: Write a program that creates three threads in Python. The first thread will ask the user to…
Q: Teddy and Tracy love to play a rope-based game. The game is as follows. At first, Tracy writes a…
A: Input/Output Explanation: The first line contains a single integer T, the number of test cases. T…
Q: COVID-19 has effected whole world. People are interested in knowing current situation of COVID-19.…
A: Define the class and structure as per the question. Using publicly declared functions. Using this…
Q: For Part B of the warm-up, you are to create a polynomial class in Java using a linked structure…
A: The polynomial number is represented using Linked List. We write a function that addresses this list…
Q: Write a Java program that creates a new thread called PrintEven, that prints the Odd numbers between…
A: Java is a programming language originally developed by James Gosling at Sun Microsystems (which is…
Q: Write a Java Program to do the following: • Create an LinkedList object and store 5 different Float…
A: The program is to be written in java which will use below inbuilt library classes:…
Q: Which one of the following is the correct way to increment the back end in a queue? a. back = back+1…
A: Answer : back = (back+1)% maxsize is the correct answer.
Q: Below is a memory diagram of a LinkedIntList object. Which of the code fragments below the diagram…
A: Answer: Node newNode = new Node();newNode.item = 50;newNode.next = first.next;first.next = newNode;
Q: Which of the following operations will NOT change the contents of a queue? enqueue getHead or first…
A: Which of the following operations will NOT change the contents of a queue? option 1 : enqueue […
Q: The find(x) method in a SkiplistSet sometimes performs redundant comparisons; these occur when x is…
A: The, given information: The find(x) method in a SkiplistSet sometimes performs redundant…
Q: mplement the producer consumer problem (also known as bounded buffer problem) in java. create two…
A: producer : The producer’s job is to generate data, put it into the buffer. Consumer : The consumer…
Q: : Which of the following data structures requires more than constant average time for insertions?…
A: Actually, the answer has given below:
Q: Queueclasss gg = new QueueClas() ¿ Stackclasss ss = new Stackclas(); gg. addoueue (4); gg. addoueue…
A: Above program has two data structure mentioned in it i.e stack and queue Firstly it adds four…
Q: Which of the following is not a queue operation? first() add() offer() isEmpty()
A: - We need to talk over the operation which is not a part of a queue. - The options :: First…
Q: please i just need screen shot for output
A: The code has the following error.
Q: Teddy and Tracy love to play a rope-based game. The game is as follows. At first, Tracy writes a…
A: Algorithm: First input contains a single integer T, the number of test cases. Then the second line…
Q: **Build a node express server with a GET endpoint for a "greetings" resource that takes a parameter…
A: What is a REST API?REpresentation State Transfer (REST) may be a set of ways during which HTTP…
Q: 4. How did we decide to handle the possibility of queue underflow? Group of answer choices Assume…
A: Note: Answering the first Question as per the Guidelines 1. Assume as a precondition that it will…
Q: Write a server and client programs that do the following based on the written pseudocode: Client…
A: If one program is running into the network and a communication link is present within them then…
Q: I have my code below and I am stuck at the last part which is the display of the thread that…
A: The Answer is
Q: Please, help to write such a program in Java! Create an app to view the waiting list and…
A: Java Queue Interface: The Queue interface present in the java.util bundle and expands the Collection…
Q: rove the binary tree search program by associating a lock with each node in the tree (as opposed to…
A: Lets see the solution.
Q: COVID-19 has effected whole world. People are interested in knowing current situation of COVID-19.…
A: Given: COVID-19 has affected the whole world. People are interested in knowing the current situation…
Q: COVID-19 has effect whole world. People are interested in knowing current situation of COVID-19. You…
A: Program Approach: Defining the main class Defining the main method Creating an object of the class…
Q: When I try to run the following Java code on netbeans IDE, it says "erroneous tree type:scanner" and…
A: This is a known bug with Netbeans IDE. there is a workaround that you can use until it is resolved.…
Q: b. Ben's second attempt uses two global semaphores. One, sem_t qlock, is initialized to 1 and…
A: Answer is given below-
Q: data МАTH data ENGL null next next top top data МАТH null next The above is a stack of textbooks.…
A: - We need to highlight the option for the required operation.
Q: I was tasked to write java linked lists but im new to it can someone help? here is the problem…
A: Start. Create the link list Add the elements. Print the last element in the list. Search some movies…
Q: Write a program that reads a line of text, changes each uppercase letter to lowercase, and places…
A: PROGRAM CODE: #include<iostream>#include<string>#define MAX 100using namespace std;char…
Q: Which of the following provides the best runtime performance to search for an element? B-Tree Stack…
A: A data structure can be understood as a specific way of organizing data in a computer system so that…
Q: Using Python threads and the module hashlib, write an MD5 Cracker. Your script must read the file…
A: Program Plan: Define md5() method that cracks the word from the specified hash. Open the hash file…
Q: A class named DownloadURL has the readAl1 (URL urls(]) method, the method accepts an array of URLS…
A: // import libraries import java.io.*; import java.net.*; import java.util.*; public class…
Q: Using Python threads and the module hashlib, write an MD5 Cracker. Your script must read the file…
A: The ask is to write a MD5 Cracker python program using threads and hashlib module.
Q: If a stack is implemented as a linked list, which XXX would replace the missing statement?…
A: A stack implemented using linked list works for the variable size of data. It will store the…
i need the answer quickly
Step by step
Solved in 2 steps
- Rewrite method inserthelp() to take advantage of the modified BSTNode in which a pointer can be either a regular pointer or a thread. Modify method printhelp() to work with threaded nodes. Add method printInorder() to do an inorder printing of your tree without the use of recursion. Add printReverse() to do a reverse order printing of your tree without resorting to recursion. You may add private helper methods as needed to make modifying or creating the methods above easier.Using eclipse, write a Console Java program that inserts 25 random integers in the range of 0 to 100 into a Linked List. (Use SecureRandom class from java.security package.SecureRandom rand = new SecureRandom(); - creates the random number objectrand.nextInt(100) - generates random integers in the 0 to 100 range)Using a ListItreator output the contents of the LinkedList in the original order. Using a ListItreator output the contents of the LinkedList in the reverse order.For Part B of the warm-up, you are to create a polynomial class in Java using a linked structure The polynomial class should consist of a linked list of nodes accessed through head.You will need to create a class of terms (Objects representing the individual terms of the polynomial) The polynomial class will consist of linked nodes: class polynomial{private node head;private int degree; The node (a node class in the same folder/package):protected terms term;protected node next; The terms (in the same folder/package) will consist of:protected double coeff;protected int power; And member methods:constructor(s)evaluate(x) add- which will add a polynomial q to the given polynomial p = p+qsubtract – which will subtract a polynomial q from the given polynomial p = p-qscale = which will multiply the given polynomial by a constant a p =apmultiply – which will multiply the given polynomial by a polynomial q p = p*qand polynomial methods:sum – which adds 2 polynomials and creates a…
- Given the following code, how would you make it thread-safe? // basic node structuretypedef struct __node_t { int key; struct __node_t *next;} node_t; // basic list structure (one used per list)typedef struct __list_t { node_t *head; } list_t; void List_Init(list_t *L) { L->head = NULL; } int List_Insert(list_t *L, int key) { node_t *new = malloc(sizeof(node_t)); if (new == NULL) { perror("malloc"); return -1; // fail } new->key = key; new->next = L->head; L->head = new; return 0; // success } int List_Lookup(list_t *L, int key) { node_t *curr = L->head; while (curr) { if (curr->key == key) { return 0; // success } curr = curr->next; } } Group of answer choices A. list_t is already thread-safe and does not need any locks in any of its operations. B. Add a lock to the list_t struct, initialize the lock in the List_Init, and then any operation that involves a…How to answer the following questions Given that values is of type LLNode<Integer> and references a linked list (non-empty) of Integer objects, what does the following code do if invoked as mystery(values)? int mystery(LLNode<Integer> list) { if (list.getLink() == null) return list.getInfo(); else return mystery(list.getLink()); } A. returns the last number on the values list B. returns how many numbers are on the values list. C. returns 0. D. returns sum of the numbers on the values list The sorted values array contains the sixteen integers 1, 2, 3, 13, 13, 20, 24, 25, 30, 32, 40, 45, 50, 52, 57, 60. How many recursive calls are made by our binarySearch method given an initial invocation of binarySearch(45, 0, 15)? A. 3. B. 1. C. 4 D. 2. E. 0 The following code is supposed to return the sum of the numbers between 1 and n inclusive, for positive n. An analysis of the code using the "Three Question" approach reveals that: int sum(int…For the Queue use the java interface Queue with the ArrayDeque classFor the Stack use the java Deque interface with the ArrayDeque classFor the LinkedList, use the java LinkedList class Also, when you are asked to create and use a Queue, you can use only those methods pertaining to the general operations of a queue (Enqueue: addLast, Dequeue: removeFirst, and peek() Similarly, when you are asked to create and/or use a stack, you can use only those methods pertaining to the general operations of a Stack (push: addFirst, pop:removeFirst, and peek() ) Your code should not only do the job, but also it should be done as efficiently as possible: fast and uses no additional memory if at all possible Questions Write a method “int GetSecondMax(int[] array)” . this method takes an array of integers and returns the second max value Example: if the array contains: 7, 2, 9, 5, 4, 15, 6, 1}. It should return the value: 9
- how to answer the following questions Given that values is of type LLNode<Integer> and references a linked list (possibly empty) of Integer objects, what does the following code do if invoked as mystery(values)? int mystery(LLNode<Integer> list) { if (list == null) return 0; else return mystery(list.getLink()); } A. returns the last number on the values list B. returns how many numbers are on the values list C. returns sum of the numbers on the values list D. return 0 Given that values is of type LLNode<Integer> and references a linked list (possibly empty) of Integer objects, what does the following code do if invoked as mystery(values)? int mystery(LLNode<Integer> list) { if (list == null) return 0; else return list.getInfo() + mystery(list.getLink()); } A.returns how many numbers are on the values list. B. returns sum of the numbers on the values list. C. returns 0 D. returns the last number on the values…A skip listThe second programming homework is already on a server (http://marmoset.famnit.upr.si).In this task, a skip list data structure should be implemented. You can follow the followinginstructions:- Implement the class NodeSkipList with two components, namely key node and arrayof successors. You can also add a constructor, but you do not need to add anymethod.- In the class SkipList implement a constructor SkipList(long maxNodes). The parameter maxNodes determines the maximal number of nodes that can be added to askip list. Using this parameter we can determine the maximal height of a node, thatis, the maximal length of the array of successors. As the maximal height of a nodeit is usually taken the logarithm of the parameter. Further, it is useful to constructboth sentinels of maximal height.- In the class SkipList it is useful to write a method which simulates coin flip andreturns the number of all tosses until the first head comes up. This number representsthe height of a node…My code does not produce the required output, can anyone let me know what seems to be off? Input: from Node import Node from LinkedList import LinkedList def print_linkedlist(list): print(f'Linked List ------ Nodes ----------------------------------') print(f'head: {list.head.name:<6}', end=' ') node = list.head while node != None: print(f"{node.name:<12}", end=' ') node = node.next print() print(f'tail: {list.tail.name:<6}', end=' ') node = list.head while node != None: print(f"data:{node.data:<7}", end=' ') node = node.next print() print(f' ', end=' ') node = list.head while node != None: if node.next != None: print(f"next:{node.next.name:<7}", end=' ') else: print("next:None") node = node.next print() print(f' ', end=' ') node = list.tail while node != None: if node.prev != None:…
- My code does not produce the required output, can anyone let me know what seems to be off? Input: from Node import Node from LinkedList import LinkedList def print_linkedlist(list): print(f'Linked List ------ Nodes ----------------------------------') print(f'head: {list.head.name:<6}', end=' ') node = list.head while node != None: print(f"{node.name:<12}", end=' ') node = node.next print() print(f'tail: {list.tail.name:<6}', end=' ') node = list.head while node != None: print(f"data:{node.data:<7}", end=' ') node = node.next print() print(f' ', end=' ') node = list.head while node != None: if node.next != None: print(f"next:{node.next.name:<7}", end=' ') else: print("next:None") node = node.next print() print(f' ', end=' ') node = list.tail while node != None: if node.prev != None:…COVID-19 has effected whole world. People are interested in knowing current situation of COVID-19. You are required to write JAVA program for storing information in a Single way Linked List. Following JAVA classes are provided. // Node class public class COVIDDetail { public String country; public int activecases; public COVIDDetail next; } // linked List class public class COVIDList { COVIDDetail start=null; } You are required to add following methods to COVIDList class 1.void add(COVIDDetail n) this method receives a node as argument and adds it to given list. Nodes are arranged in descending order with respect to number of cases. Note that you are not required to sort the list in fact while adding first find its appropriate position and then add given node to that position. 2.void updateCases(String country_name , int cases) this method receives two arguments country name and cases (can have positive or negative value). Update active cases of those countries whose name…The programming language is Python Instructions: Create a function that will delete a node in a Linked List based on position number. On below example, if you want to delete position #2, it will remove the Banana (arrangement of nodes below is Apple, Banana, Cherry, Grapes, Orange). myLinkedList = LinkedList() myLinkedList.append("Banana") myLinkedList.append("Cherry") myLinkedList.append("Grapes") myLinkedList.append("Orange") myLinkedList.prepend("Apple") myLinkedList.deleteByPositionNum(2) node = myLinkedList.head while node: print(node.value, " ") node = node.next_node You may start with the function head:def deleteByPositionNum(self, positionNum):