Write a java program to generate twenty five random integers

Assignment Help Data Structure & Algorithms
Reference no: EM132387950

Question 1
What is the output from the following sequence of linked list operations?

LinkedList<String> myList = new LinkedList<String>();

ListIterator<String> iter;
myList.addFirst("John");

myList.addFirst("David");

iter = list.listIterator(); iter.next();

iter.add("Peter"); iter.next();

iter.add("Joshua");

Question 2
Write an application to implement the three Set operations: intersection, union, and difference. You should build three methods corresponding to the operations. In your main method, test these methods on two HashSets of Strings.

Question 3
Create a PriorityQueue of type Integers and add the following values which represent months: 2, 5, 8, 3, 11, 7, and 6.
• Display the values using the peek method.
• Remove 2 from the queue and add 12.
• Remove 3 and add 4 to the queue.
• Display the queue.

Question 4

What is Big-O notation? By using the definition of Big-O, show that the running time for term T(n)=100+2n+ n2 is O(n2).

Question 5

Write a java program to generate twenty five random integers between 0 and 100 (inclusive), display the values, display the sorted values, sum, and average of the values. Use Lambdas.

Question 6

Create a database named Books and write and execute the query to create an Authors Table having three columns - AuthorID, FirstName, and LastName.
Create the database and table programmatically.

• Write preparedStatement to insert values into the Authors table.
• Use PreparedStatement to search and display author details of an author whose firstName is entered from the keyboard.

Question 7
Write a method to calculate the sum of integers 1 to n recursively.

Question 8

The following Java code segment uses the data structure - queue. It contains some operations such as enqueue( ) and dequeue( ). Please write down the output when the code segment is executed. Queue class has implemented standard Queue interface.

Queue<Integer> q = new Queue<Integer>(); int a = 10;
q.enqueue(5);
q.enqueue(a); q.enqueue(20);

System.out.println(q.peek()); q.dequeue();
q.enqueue(30); while (!q.isEmpty())
System.out.print(q.dequeue() + " ");

Question 9

Manually provide the inorder, preorder and postorder traversals of the binary search tree as shown below.

2404_figure.jpg

Reference no: EM132387950

Questions Cloud

What would happen to the market for both california oranges : What would happen to the market for both California oranges and Florida oranges if there is a freeze in Florida that destroys 20% of the orange crop?
How many new facilities should be created : The official has information on the following costs and benefits of expanding the number of facilities:
Market for personal computers : What can we expect to happen in the market for personal computers? How do the price and quantity at equilibrium change? Explain verbally and graphically.
Do the same considerations and the same responses : Do the same considerations and the same responses - apply to corporate spending? How does one measure "waste"?
Write a java program to generate twenty five random integers : Write a method to calculate the sum of integers 1 to n recursively - Create a database named Books and write and execute the query to create an Authors Table ha
What effect would a price increase have on the total revenue : What effect would a price increase have on the total revenues earned from the proposed product?
What does it mean if a good has inelastic demand : What does it mean if a good has inelastic demand? Provide an example of an inelastic good?
Explain why the acceptance of lower-grade job : Explain why the acceptance of lower-grade job is itself a form of unemployment.
What would you tell him about future revenue : If you were working in a gas station and the manager wants to increase the price of gasoline 5%,

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

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

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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