3) Here following the java code for BinarySearch public static int binarySearch(int[] list, int key) { int low = 0; int high = list.length - 1; while (high >= low) { int mid = (low + high) / 2; if (key < list[mid]) high = mid - 1; else if (key == list[mid]) %3D return mid; else low = mid + 1; } return -1; } a. Trace the code to show the steps performed by the code to search for the key=12 in the following list: { 12, 14, 17, 18, 20, 21, 23}
Q: 2) Consider a class for a node of a doubly linked list: class node{ String name; String city; node…
A: class node{ String name; String city; node llink, rlink; node(String name , String city){…
Q: 3. Write a Java program that generates randomly a list of N integers, sorts the generated list using…
A: Created two different programs to illustrate merge sort and quick sort. Integer…
Q: Write, in C#, Python, or Ruby, an iterator that yields (a) all permutations of the integers 1 ..n…
A: python permutation - all possible way of arranging the elements present in the list. code : def…
Q: A linked list is developed with the following set of nodes in sequence: 25, 40, 66, 38 and 53. The…
A: A linked list is a sequence of data structures, which are connected together via links. Linked List…
Q: Q5. Spot the error in the following code that is supposed to sort the list t and print it? How would…
A: sort is a function that sorts the list and it doesn't returns the same list again You can say it as…
Q: Create a Java program. You have a list of Student ID's followed by the course number(separated by…
A: Below code contains HashMap with Integer as key which stores student ids and ArrayList as value…
Q: Assuming appropriate libaries and namespaces have been included/utilized, what is produced by the…
A: If myList is an initially empty array-based unsorted list then You will get the output output:…
Q: Consider the following "SequenceList" class: import java.util.ArrayList; public class SequenceList {…
A: 1. a) listA obj=new listA(); obj.displaylist(); b) bool a,b; int b=new int[-18,-1,6,9,12];…
Q: Can you answer with Python programming language ? Write a function that takes two arguments: stock…
A: The program loops through each item in stock for the required item i.e.for the first item in the…
Q: The language used here is in Java. Please answer the question in the screenshot. Please use the code…
A: Coded in Java.
Q: Write a java program to find the sum of elements of the array recursively.
A: As per guidelines, we are supposed to answer only one question. Kindly repost others questions as a…
Q: (3) Consider the linked list provided below: 2 > 3 >1>7>5> 18 > NULL Here the > symbol means a…
A: Please refer code and output : Language used is JAVA The time complexity is O(n): import…
Q: 2.1 Write a complete Java program called List for the Linked List pseudocode below: 1. Create mylist…
A: import java.util.LinkedList;//creating classpublic class List { public static void main(String[]…
Q: In Java: Write a program that reads an integer, a list of words, and a character. The integer…
A: Given: Write a program that reads an integer, a list of words, and a character. The integer…
Q: Consider the following code class Node String name; Node next; public Node(String name) this.name…
A: The following are the correct answers to be filled in the blanks: p1; p2;
Q: I need a C++ Program which reads the numbers till -5 was entered. After that, program will display…
A: i give this question answer in next step with using linked list for get value with user and print…
Q: Writen in Java. Please give a step by step explanation of the ouput for the following code. public…
A: public class TestTwo{public static void main(String[] args){int[] list = {1,2,3,4,5,6};for(int i =…
Q: In the C programming language Suppose you are given an array of integers. You want to insert a…
A: #include<stdio.h>void rearrange(int *a, int n, int insert, int *b);void rearrange(int *a, int…
Q: Helo there, I am having trouble identifying where I have gone wrong in the below code that I have…
A: We need to find why the set of options shows over and over again and we need to fix it.
Q: Write a program in C/C++ that reads N number of nonnegative decimal numbers from a user and creates…
A: Write a C or C++ program that will give output as per following: Example test run Test Run 1: Enter…
Q: java please, All of the solution that you have given doesn't take in to account the requirement for…
A: import java.util.*;class Test106 { public static void main(String args[]) { Scanner sc = new…
Q: The following is a class definition of a linked list Node: class Node { int info; Node next; }…
A: Primitive data type gets memory in stack area. When values are not assigned to primitive data type,…
Q: In Java, consider the following declaration. double[] list = new double[75]; Which of the…
A: Here we have an array whose size is initialized to 75. This array will store 75 elements in the…
Q: In c++ , write a program to create a structure of a node, create a class Linked List. Implement all…
A: #include <iostream>using namespace std; struct Node{int data;Node *next;}; class…
Q: Write code in C++, C# or Python to solve the following problem: In a party there are N persons and…
A: ANSWER:-
Q: Assume that the following method is added to the class KWLinkedList. What is the functionality of…
A: Answer: Return the element at the tail of the list and remove it from the list.
Q: Suppose you are given an array of integers. You want to insert a number x to the array and rearrange…
A: Basically, an input array is taken and an element has to be inserted into it, in such a way that all…
Q: I've attached the question. Below, you will find my python code answer. It doesn't output correctly,…
A: Answer: We have add one function as name insert in the your code then we got correct result in the…
Q: 1. Write a program that inputs an array of numbers from the command line, and averages them. The…
A: Command-line arguments: In java programming, the command line arguments are passed at the time of…
Q: *in java* A contact list is a place where you can store a specific contact with other associated…
A: Answer is given below .
Q: 1. Assume you have the following singly linked List of integers and the method printLL(): Head ↓…
A: Here is the explanation of the final link list will look like after the operatons:
Q: of KWArrayList class public static void Unknown(KWArrayList list1, KWarrayList list2) { if…
A: Ans : Assume that the following method is outside the class of KWArrayList class but has access to…
Q: Could you help me the following question? The Node structure is defined as follows (we will use…
A: In Java Data Structures each cell is called a node of a singly-linked list. First node is called…
Q: Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns…
A: 1. Initializing CurrentRow =0 and CurrentColumn=1 2. Using the while loop and checking if the…
Q: java Create a method that takes a list of type integer and find the duplicates. the duplicates are…
A: import java.util.Arrays;import java.util.HashSet;import java.util.Set;import static…
Q: //No need for the whole code //just the methods please for both Write a recursive method “int…
A: The recursive method for finding the sum of positive integers in a linked list referenced by head…
Q: Write a java program. call it sortWords. Read from the command line a list of words, any number,…
A: Copy the command line arguments to an ArrayList Then, we have to sort the list Then, we have to…
Q: Suppose a method in Java receives the following argument: List list Which of the following is true?…
A: In java List <? > list
Q: #include usingnamespace std; class Queue { int size; int* queue; public:…
A: Polymorphism is an OOP concept by which we can perform a single action in different ways i.e. using…
Q: PLEASE COMPLETE THIS PYTHON PROGRAM BY FILLING OUT FOLLOWING BLANKS AND ALSO ATTACH class…
A: Required: PLEASE COMPLETE THIS PYTHON PROGRAM BY FILLING OUT FOLLOWING BLANKS AND ALSO ATTACH
Q: TRANSFORM THE C++ CODE BELOW INTO JAVA CODE. raw code:- #include using namespace std; using…
A: Below is c++ code which is being converted to java code:
Q: //asking this question again as the answer I was provided did not appear to follow the instructions…
A: Program Explanation: 1) In the program here define the class comparison. 2) Then, define the method…
Q: Exercise #1 What is the output of the following code? Given the following classes public class Demo…
A: The question code is written in Java. Please find the solution below.
Q: 1. Assume you have the following singly linked List of integers and the method printLL(): Head ↓…
A: Given questions are not interlinked. As per our guidelines only one question will be answered. So,…
Q: PROBLEM STATEMENT: Return a sublist of a given list from the range of the two integer inputs from,…
A: We need to define a java method FindSublistFromRange that returns a list of numbers between a…
Q: In Java: -Using a BST Interface (Binary Search Tree) -Create a class Disk. Disk contains four…
A: Answer: our instruction is answer the first three part from the first part and . I have done code in…
Q: Problem B Write a Java application CountryList. In the main method, do the following: 1. Create an…
A: Note: Answering the first three subparts as per the guidelines. Task : Create the array :…
Q: In which memory a String is stored if we create it using new operator? a. Stack b. String memory…
A: HI THERE I AM ADDING ANSWER BELOWPLEASE GO THROUGH ITTHANK YOU
Q: Java The following code was not exactly explained how the list[i] = list[i-1] *2 works. Can you…
A: Output of the given code is, Explanation: "list" is an one dimensional array and it is initialized…
Step by step
Solved in 2 steps
- Please write in C++ Please write a program that uses a class named QuadProb that uses a hash table using quadratic probing that has a function for insertion, deletion, and search. Please do not use anything from the STL.*in java* A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Assume that the list will always contain less than 20 word pairs. Ex: If the input is: 3 Joe,123-5432 Linda,983-4123 Frank,867-5309 Frank the output is: 867-5309 Your program must define and call the following method. The return value of getPhoneNumber() is the phone number associated with the specific contact name.public static String getPhoneNumber(String[] nameArr, String[] phoneNumberArr, String contactName, int arraySize) Hint: Use two arrays: One for the string names, and the other for the string phone numbers.…I need a C++ Program which reads the numbers till -5 was entered. After that,program will display the smallest and largest numbers and the numbers between smallestand largest. It is not allowed to use vector or array, you have to use data structures(linked list,sorting,insert item,delete item vs) sample output: Input the numbers: 5 12 53 6 9 4 18 27 88 36 45 54 -5Result: 4 18 27 88 Input the numbers: 23 97 63 15 88 21 36 45 -5Result: 97 63 15 88 21
- Given subsets A and B of a universal set with 10 elements {0, 1, 2, 3, 4, 5, 6, 7, 8,9}. Write a C++ or Java program that uses bit strings to find A È B, A Ç B, and A – B. Print tothe screen set A, set B ( be sure to print out the name of the sets), as well as the set operation results(be sure to print out the name of the operations).The program requires that elements of subsets A and B are from user input. You can make theassumption that user input numbers are within the domain of the set {0, 1, 2, ..., 9} and there isno improper input.Additional requirements and reminders:• The use of STL, templates, and operator overloading is not permitted in any form.• Remember: You must use a bit string when representing a set. You may not use an array ofBoolean variables.• The elements of subset A and subset B must from user input. You may not hardcode the twosubsets in your program.Write a C++ or Java program that uses bit strings to find A ∪ B, A ∩ B, and A – B given subsets A and B of a universal set with 10 elements {0, 1, 2, 3, 4, 5, 6, 7, 8,9}. You have to use bit string Print to the screen set A, set B ( be sure to print out the name of the sets), as well as the set operation results(be sure to print out the name of the operations). The program requires that elements of subsets A and B are from user input. You can make the assumption that user input numbers are within the domain of the set {0, 1, 2, ..., 9} and there is no improper input.Additional requirements and reminders:• The use of STL, templates, and operator overloading is not permitted in any form.• Remember: You must use a bit string when representing a set. You may not use an array ofBoolean variables.• The elements of subset A and subset B must from user input. You may not hardcode the two subsets in your program.Hint:(1) It is a bit easier to program if we construct the bit string of a set…Please explain the flow of this C++ Program. It doesn't have to be long as long as you explain the each function of the program, if you can explain it line by line then it is better and I will give you a good rating. #include <cstdlib> #include <math.h> #include <cstring> #include <iostream> using namespace std; class HashTable { string* table; int N; int count; // TODO: Polynomial Hash Code using a=7 int hash_code(string key) { int code; int hash = 0; for (int i = 0; i < key.size(); i++) { char ch = key[i]; code += ((ch - 96) * pow(7, key.size() - (i + 1))); } return code; } // TODO: This hash table uses a MAD compression function // where a = 11, b = 461, p = 919 int compress(int code) { return (((11*code)+461) % 919) % N; } // Using the knowledge that a hash function is composed of two portions int hashfn(string key) { return compress(hash_code(key)); } public:…
- A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output "None" if name is not found. Ex: If the input is: 3 Joe,123-5432 Linda,983-4123 Frank,867-5309 Frank the output is: 867-5309 Your program must define and call the following function. The return value of GetPhoneNumber is the phone number associated with the specific contact name.string GetPhoneNumber(vector<string> nameVec, vector<string> phoneNumberVec, string contactName) Hint: Use two vectors: One for the string names, and the other for the string phone numbers.Using java, write an easier version of a linked list with only a couple of the normal linked list functions and the ability to generate and utilize a list of ints. The data type of the connection to the following node can be just Node, and the data element can be just an int. You will need a reference like (Java) or either a reference to the first node, as well as one to the last node. (Answer the following questions) 1) Create a method or function that accepts an integer, constructs a node with that integer as its data value, and then includes the node to the end of the list. If the new node is the first one, this function will also need to update the reference to the first node. This function will need to update the reference to the final node. Consider how to insert the new node following the previous last node, and keep in mind that the next reference for the list's last node should be null. 2) Create a different method or function that iteratively explores the list, printing…In C# Suppose variable nums contains a list of integers.List«Integer> nums = Arrays.asList(1, 1, 2, 3, 4, 1, 3, 2, 4, 3, 3, 1);var nums = new List«int> { 1, 1, 2, 3, 4, 1, 3, 2, 4, 3, 3, 1 }Using Java Stream API *or* LINQ, write a short code that prints the following.For each section indicate the platform (whether the solution is given in Java orC# LINQ).A) Print all numbers.B) Print the sum() of the numbers.C) count how many times number '1' appears in the list.
- Here is a program that uses recursion to convert a decimal number into an equivalent binary number. By using C++ STL, write a program that uses a stack to convert a decimal number into an equivalent binary number. Example: #include <iostream> using namespace std; void decToBin(int num, int base); int main() { int decimalNum; int base; base = 2; cout << "Enter number in decimal: "; cin >> decimalNum; cout << endl; cout << "Decimal " << decimalNum << " = "; decToBin(decimalNum, base); cout << " binary" << endl; return 0; } void decToBin(int num, int base) { if (num > 0) { decToBin(num / base, base); cout << num % base; } }Write a function randomList() that gets three integers as parameters, start, bound and k. This function will create a list of k randomly generated integer numbers between start and bound values (both inclusive), and return the created list.Write a function sqrtList() that gets a list as parameter, print the numbers in the list and their square root. The square roots will be printed with 3 decimal digits. Write Python statements that ask the user to input start, bound and k values, then call the method to perform the calculations and produce the output.At the end print average of numbers by calling the function calculateAverage(). Part-2:Enter start: 10Enter end: 30Enter k: 41. number: 28 Square root = 5.2922. number: 22 Square root = 4.6903. number: 10 Square root = 3.1624. number: 16 Square root = 4.000Average of numbers is = 19.0Write a function randomList() that gets three integers as parameters, start, bound and k. This function will create a list of k randomly generated integer numbers between start and bound values (both inclusive), and return the created list.Write a function sqrtList() that gets a list as parameter, print the numbers in the list and their square root. The square roots will be printed with 3 decimal digits. Write Python statements that ask the user to input start, bound and k values, then call the method to perform the calculations and produce the output.At the end print average of numbers by calling the function calculateAverage().