In: Computer Science
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;
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 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 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 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:
In: Computer Science
In: Computer Science
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 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