Questions
1.Write Java code for extending the LinkedList<E> class of java.util.* to ExtLinkedList<E> that would include the...

1.Write Java code for extending the LinkedList<E> class of java.util.* to ExtLinkedList<E> that would include the following method:



public ExtLinkedList <E> mergeThreeLists (ExtLinkedList<E> list1, ExtLinkedList<E> list2) {

}
that returns an ExtLinkedList<E> which is the merged version of values from this list, followed by values from list1, and then followed by values from list2. For example, if E is Integer type and this list has (5,3,1), list1 has (8, 10,12,14), and list2 has (22,23,24,25,26) in that order, then the returned list from a call to list.mergeThreeLists(list1,list2) will have (5,3,1,8,10,12,14,22,23,24, 25,26). Obviously the size of the returned list will be equal to list.size()+list1.size()+list2.size(). Use listIterator() to do this efficiently for full credit. Your code should work for any size including the empty list and any parameter E.

In: Computer Science

Write a program that first gets a list of integers from input. The input begins with...

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain fewer than 20 integers.

That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a space, even the last one. The output ends with a newline.

Ex: If the input is:

5 25 51 0 200 33
0 50

then the output is:

25 0 33 

(the bounds are 0-50, so 51 and 200 are out of range and thus not output).

To achieve the above, first read the list of integers into an array.

In: Computer Science

How to reverse linked list below,thank you! #include <stdlib.h> #include <stdio.h> struct list { int data;...

How to reverse linked list below,thank you!

#include <stdlib.h>
#include <stdio.h>
struct list
{
int data;
struct list *next;
};
typedef struct list node;
typedef node *link;
int main()
{
link ptr,head;
int num,i;

head = ( link ) malloc(sizeof(node));
ptr = head;
printf("enter 10 data \n");
for ( i = 0; i <= 9; i++ )
{
scanf("%d",&num);
ptr->data = num;
ptr->next = ( link ) malloc(sizeof(node));
if ( i == 9 )
ptr->next = NULL;
else
ptr = ptr->next;
}
printf("original linked list\n");
ptr = head;
while ( ptr != NULL )
{
printf("data==> %d\n",ptr->data);
ptr = ptr->next;
}
  
system("pause");
return 0;
}

In: Computer Science

Given the following list of values, perform a binary search for the indicated search item. Use...

Given the following list of values, perform a binary search for the indicated search item. Use the binary search algorithm on pg. 1026 of our textbook. Show the values of first, last and middle, and the number of comparisons made after each iteration of the loop. Your should create a table like the following to show your work, where first and last are the values of the variables at the beginning of the loop, and mid is the midpoint used during that iteration, list[mid] is the value in the list at the midpoint, and No. of key comparisons should be the number of comparisons made during this iteration by the algorithm:

Iteration  first   last    mid  list[mid]   No. of key comparisons
1          0       12      ?    ?           ?

List:
[ 2, 3, 4, 4, 5, 7, 10, 14, 15, 17, 22, 23, 24 ]

Searching for value: 3

In: Computer Science

What are the three categories of torts? What does the UCC Section 2 cover? What does...

What are the three categories of torts?

What does the UCC Section 2 cover? What does the UCC Section 2a cover?

What are the differences between contract law and UCC law?

What is a sale? What is a merchant?

What is the difference between goods and services?

What is the predominant rule?

What terms does the UCC allow to be open? What cannot be open?

What is a merchant’s firm offer?

What are a person’s alternatives if they are sent non-conforming goods?

What happens under the UCC if additional terms are included in the acceptance?

10.   What are the requirements for modifications under the UCC?

11.   What is the perfect tender rule?

12.   List and define the exceptions to non-conforming goods being considered a breach.

13.   List the obligations of the Buyer.

14.   List the obligations of the seller.

15.   What is anticipatory repudiation?

16.   List and define the Seller’s remedies.

17.   List and define the Buyer’s remedies.

What is a warranty of title?

List and define the types of implied warranties.

What are warranty disclaimers?

In: Finance

The implementations of the methods addAll, removeAll, retainAll are omitted in the MyList interface. Implement these...

The implementations of the methods addAll, removeAll, retainAll are omitted in the MyList interface. Implement these methods.


/** Adds the elements in otherList to this list.
* Returns true if this list changed as a result of the call */
public default boolean addAll(Collection<? extends E> c)


/** Removes all the elements in otherList from this list
* Returns true if this list changed as a result of the call */
public default boolean removeAll(Collection<?> c)


/** Retains the elements in this list that are also in otherList
* Returns true if this list changed as a result of the call */
public default boolean retainAll(Collection<?> c)


Write a test program that creates two MyArrayLists, list1 and list2, with the initial values {"Tom", "George", "Peter", "Jean", "Jane"} and {"Tom", "George", "Michael", "Michelle", "Daniel"}, then perform the following operations:
■ Invokes list1.addAll(list2), and displays list1 and list2.
■ Recreates list1 and list2 with the same initial values, invokes list1.removeAll(list2), and displays list1 and list2.
■ Recreates list1 and list2 with the same initial values, invokes list1.retainAll(list2), and displays list1 and list2.

In: Computer Science

Import the northwind database and write sql statements for the following: List all supplier ids (no...

Import the northwind database and write sql statements for the following:

  1. List all supplier ids (no duplicates) for all products.
  2. List the product name and supplier id for all products that cost more than $20.
  3. List all products whose names start with letter "c" and are not discontinued.
  4. List each country name and the number of suppliers located in the country.
  5. List all supplier names, the number of products that each supplier provides (this column should be named as NumOfProducts), and the average price for the products provided by the same supplier (this column should be named as AvgPrice).
  6. Find all suppliers' name, city, and country for those who provide non-discontinued products.
  7. List all supplier names who provide at least two different products.
  8. Add a new product record to the products table. You must provide values for the following fields in the new product record: ProductID, productName, SupplierID, and CategoryID.
  9. Increase the reorder level by 20% and reduce the prices by 10% for all products
  10. Delete discontinued products.

In: Computer Science

Pycharm Write a function to make a new list 1. if original_samples is [1,2,3], then this...

Pycharm
Write a function to make a new list
1. if original_samples is [1,2,3], then this should return a new list [3,2,1]. Don't use the reversed function or original_samples[::-1]

def make_reserved_samples (original_samples):
new_samples[ ]
  
return new_samples

2. multiplied by volume. If original_samples is [1,2,3] and volume is 2, the new list is [2,4,6]

def make_louder_samples(original_samples, volume):

return [ ]

3. If the original list is [1,2,3,4,5,6,7,8] and skip is 3, the new liat should be [1,4,7]. Don't use original_list[::skip]. you must use a loop to find the desired elements.

def make_reduced_samples(original_samples, skip):

return[ ]

4. if original samples is [-5,-1,2,5,10] and clip level is 4, then new liat would be [-4,-1,2,4,4]

def make clipped_samples(original_samples, clip_level):

return [ ]

5. if the original list is [10,20,30] and noise_level is 2, the a new list is [8,21,29] if the random ints picked happened to be -2,-1,-1 return the new list

def make_noisy_samples(origianl_samples, noise_level):
return [ ]
6. write a function to make a tone. Each "sawtooth" should be valus going from -10000 to 10000 counting by 1000. So the elements should be -10000,-9000,-8000,-7000,-6000, .........., 7000,8000,9000,10000. Then there should be 1000 sawtooths.

def make_tone( ):
return [ ]


In: Computer Science

Please do not use vectors or any previously posted code Write a C++ program which reads...

Please do not use vectors or any previously posted code

Write a C++ program which reads in a list of process names and integer times from stdin/cin and simulates round-robin CPU scheduling on the list. The input is a list of lines each consisting of a process name and an integer time, e.g.

ProcessA 4

ProcessB 10

Read line by line until an end-of-transmission (^d) is encountered. You should read the list and represent it in a linked list data structure. You should use the alarm system call to schedule a timer interrupt every 3 seconds. The interrupt handler should pick the next process from the process list, write a message saying how much time it has left to execute,

i.e.

ProcessA 4

Then update its time left to execute by subtracting 3 seconds and return it to the end of the queue. If the process had no time left to execute, you should write a message saying this

i.e.

ProcessA Finished

And delete this process from the linked list.

If there are no processes left to execute, write a message saying

No processes left

And terminate your program.

If further information is needed please specifically comment what is needed.

In: Computer Science

This problem should be solved using the DrRacket software in the Racket/Scheme language. Consider two techniques...

This problem should be solved using the DrRacket software in the Racket/Scheme language.

Consider two techniques for representing a graph as Scheme lists. We can represent a directed graph as a list of edges. We call this representation an el-graph (i.e. edge-list graph). An edge is itself a list of length two such that the first element is a symbol denoting the source of the edge and the second element is a symbol denoting the target of the edge. Note that an edge is a list (not just a pair). For example, the following is a graph: '((x y) (y z) (x z)). We can also represent a graph similar to an adjacency matrix. We call this representation an x-graph (i.e. matrix-graph). In this case, a graph is a list of adjacencies where an adjacency is a list of length two such that the first element is a node (a symbol) and the second element is a list of the targets of that node. For example, the following is a graph: '((x (y z)) (y (z)) (z ())).

- Write function (el-graph->x-graph g), that accepts an el-graph g and returns an x-graph of g.

- Write function (x-graph->el-graph g), that accepts an x-graph g and returns an el-graph of g.

In: Computer Science