Apply following to header and footer sections of page in css
center text
background color rgb(254,198,179)
padding should be 20px
In: Computer Science
The following program uses Pthreads to create two threads. They do some work for the process and then exit. The process then outputs a result.
Assume all supporting libraries and other functions have been included.
=> Use the answer text field to describe what work (operations) the threads are doing, and what kind of result (what is it?) is output by the process.
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
int res1, res2, a[100], b[100];
void *runner1(void *param);
void *runner2(void *param);
void readData(int []);
int main(int argc, char *argv[])
{
pthread_t tid1, tid2;
pthread_attr_t attr;
readData(a);
readData(b);
pthread_attr_init(&attr);
pthread_create(&tid1, &attr, runner1, argv[1]);
pthread_create(&tid2, &attr, runner2, argv[1]);
pthread_join(tid1,NULL);
pthread_join(tid2,NULL);
printf("result = %d\n", res1+res2);
}
void *runner1(void *param)
{
int i, upper = atoi(param);
res1 = 0;
for (i = 0; i < upper; i++)
res1 += a[i];
pthread_exit(0);
}
void *runner2(void *param)
{
int i, upper = atoi(param);
res2 = 0;
for (i = 0; i < upper; i++)
res2 += b[i];
pthread_exit(0);
}
In: Computer Science
execute coding examples that demonstrate the 4 scope rules
file,function,class,block
coding language c++
In: Computer Science
1. Read a line of input from the user (as a string) and find out if there are any vowels in the string. Use a break or continue keyword (whichever is appropriate) to notify that a vowel has been found. Prompt for another string and search again until the user enters 'exit' into the program.
2. Ask the user how many random numbers they would like to see. Ask the user to provide the lowest number they would like to use and the highest number. Only return integers between those two numbers.
Java language
In: Computer Science
Based on the following Python code, write a Python statement which outputs “December” when the value of the Month is 12 or “November” when the value of the Month is 11 or “Neither” when value of the Month is neither 11 or 12. The user enters the value which is store in the variable namedMonth.
Month = int(input("Please enter the value of the month in numerical format such as 11 for November, or 12 for December: " ))
sing Python
In: Computer Science
write a c++ program
Find an algorithm and show the codes for evaluating the number of numbers between 200 and 1000 that are divisible by 2 and 7
In: Computer Science
the language that suggested is java
- Given the following sorting techniques, that uses the algorithmic design techniques of Induction and Divide and Conquer paradigm:
a. Quicksort using pivot as the maximum element
b. Quicksort using a random pivot element
c. Quicksort using a pivot as the median element (Finding pivot in linear time)
d-insertion sort
e- merge sort
Perform the following tasks: A. Write the algorithm for each technique. B. Implement the code for each technique. C. Test your implemented code using the test cases provided in the next section. D. Compare the performance with respect to the time complexity of these algorithms against each other using the empirical results obtained in the previous task by plotting charts. E. Provide a technical analysis about the time complexity of these problems by using the charts from the previous task.
Input Cases: Problem instance size (n) a) For each technique, the size of n varies as 100, 1000, 10000, 100000 For each problem instance size, distinct input values should be randomly generated using the following specifications: b) Generate distinct random values between the range of: i. 1 and 500 ii. 100 and 1000 iii. 5000 and 100000 As such, for each problem you will have 12 executions (4 problem instance size each having 3 different input value generation range)
how to perform showing Analysis:
you will plot a single multi-line chart. The ticks on the x-axis
will represent each problem instance size
and y-axis will represent a count of the number of comparisons
performed for each technique given a
problem instance size. The series in these line charts will
represent the different sorting techniques you
have implemented. Use values generated between the range of 5000 to
100000 for each problems’
problem instance size.
In: Computer Science
How could this be implemented in C?
binstring[] = 1011001000010110000100010100110010010101101100011101000110010000100010100110010010101101100011101101000010001010011001001010110110001110001010011001001111100001000100010001000100010001
~ 160 characters long divided into groups of 5 ~
This function takes a starting position and the array of ‘1’ and ‘0’ and returns the character
representation of the five bits at that location.
char byte_at( int position, const char binstring[] ) {
}
In: Computer Science
Given a string sentence that consists of some words separated by a single space, and a string searchWord.
Write a function isPrefix to check if searchWord is a prefix of any word in sentence. A prefix of a string S is any leading contiguous substring of S. It returns the index of the word in sentence where searchWord is a prefix of this word (1-indexed).
If searchWord is a prefix of more than one word, return the index of the first word (minimum index). If there is no such word return -1.
Input: sentence = this problemo is an easy problemo, searchWord = pro
Output: 2
Explanation: pro is prefix of problemo which is the 2nd and the 6th word in the sentence, but we return 2 as it's the minimal index.
In: Computer Science
How to determine what type of attribute the following attributes are in an Entity-Relationship Model? I just want to know if each of these can be considered as a composite attribute, a multi-valued attribute or neither:
Suppose we have:
1. Name : A person's full name
2. Address : A residential address
3. Account Balance : A bank account balance
4. Monthly fees: Monthly fees associated with a chequing account, which are unique to each account holder
5. Minimum Balance: The minimum balance needed to maintain a chequing account, which is unique to each account holder
6. Interest Rate: Interest rate associated with a savings account that changes over time.
7. Loan Payment Amount: Amount paid towards a loan.
8. Date-Time: YYYY-MM-DD HH-MI-SS
9. Type of Transaction: Deposit or withdrawl from an account
10. Date of Birth: A person's date of birth
11. Date-Time: YYYY-MM-DD HH-MI-SS
12. Service Details: Details regarding the services a bank has provided for a customer
In: Computer Science
Explain Session Management in your OWN words.
In: Computer Science
in Java, I am writing a program where you need to pick a color. The color must be red, blue, or green and is a user input. If they put in a different value I need the program to stop running. So I essentially need to write code that says, if variableColor does not equal "red", "blue", or "green" then I need to print the statement "invalid response" and exit the program. How can I write this?
In: Computer Science
Compare and contrast the WiFi IEEE 802.11ax standard and latest Bluetooth standards. Your comparison should be based on technical specification and performance (e.g., data rate, modulation, range, no of channels and MIMO antenna, security features and other parameters; you should list as many as you can). Do you view WiFi and Bluetooth as competing or complimentary technologies? Justify your answer
In: Computer Science
Write an essay on "ONLINE CLASSES ISSUES AND CHALLENGES". The essay should be 250 to 300 words. The first paragraph includes the introduction of online classes. You can divide the essay into 4 paragraphs. These below topics are compulsory to discuss in the essay ( IMPORTANT NOTICE)
Points:
In: Computer Science
JAVA:
You're given two classes List.java and Node.java. In your List class you're supposed to implement the methods toFront, print, and toBack. The Node class is used as a reference no edit necessary.
LIST:
public class List {
protected Node head, tail;
/**
* Initialize the list to empty. Both head and tail
* are null references in this case.
*/
public List() {
// TODO Auto-generated constructor stub
head = tail = null;
}
/**
* Add nodeToAdd to the front (head) of this list.
* @param nodeToAdd to the front of this list.
*/
public void toFront(Node nodeToAdd) {
}
/**
* Print all nodes from the list to System.out
*/
public void print( ) {
}
/**
* Add nodeToAdd to the back (tail) of this list.
* @param nodeToAdd node to add at the back (tail) of this list.
*/
public void toBack (Node nodeToAdd) {
}
}
NODE:
public class Node {
protected String contents; // the contents of this LLNode
protected Node next; // Reference to next LLNode in list.
/**
* The constructor -- The default constructor will
* build a node with a null reference for the string
* and a null reference for the next item in the list.
*/
public Node() {
this(null, null);
}
/**
* Initializes this linked list node to the string
* given and sets the next reference to null.
* @param contents The string to store in this LLNode
*/
public Node(String contents) {
this (contents, null);
}
/**
* Initializes this linked list node to the string and
* LLNode reference passed in.
* @param contents The string to store in this LLNode
* @param next The reference to the next item in the List.
*/
public Node(String contents, Node next) {
this.contents = contents;
this.next = next;
}
/**
* @return the contents of this linked list node.
*/
protected String getContents() {
return contents;
}
/**
* @param contents the string to store in this linked list node.
*/
protected void setContents(String contents) {
this.contents = contents;
}
/**
* @return the reference to the next item in the Linked List
*/
protected Node getNext() {
return next;
}
/**
* @param next the Node to set as the node to follow this item in the list.
*/
protected void setNext(Node next) {
this.next = next;
}
}
In: Computer Science