Design an algorithm that minimises Ccmp, the number of comparisons of two books’ labels in the alphabetical order, and Cmov, the number of book movements (one movement is counted whenever a book is moved from one location to another) in the worst case. Suppose there arenbooks on the main shelf, which haveal ready been sorted in an ascending alphabetical order. The m newly arrived books are carried into the library on a portable shelf.
a) Scenario 1: The newly arrived books have also been sorted in an ascending alphabetical order and you are allowed to use a temporary shelf of an infinite capacity. Design an algorithm (description + pseudo code) for the robot to arrange the new books onto themain shelf using Ccmp=Θ(n+m) label comparisons and Cmov=Θ(n+m) book movements in the worst case. Explain why your algorithm has the stated worst case complexity (ignoring the constant and choosing the dominant term in your analysis).
Algorithm ArrangingBooksScenario1(A,B,C,n,m)
//A,B, and C represent the arrays of book labels for the main, the portable, and the temporary shelves
//COMPLETE WITH YOUR PSEUDO CODE HERE
b) Scenario 2: There is no temporary shelf to use in the library and the number of newly arrived books,m, is a small constant compared ton, for instance,m=10. Design an algorithm (description + pseudo code) for the robot to arrange the new books onto the main shelf using Ccmp=Θ(log(n)) label comparisonsin the worst case. What is the number of book movements Cmov incurred in the worst-case of your algorithm and why?
Algorithm ArrangingBooksScenario2(A,B,n,m)
// A and B represent the arrays of book labels for the main and the portable shelves
//COMPLETE WITH YOUR PSEUDO CODE HERE
P/s: I have already posted this question, but haven't received a useful idea for it. So, please help me with a useful idea and more detailed pseudocode.
In: Computer Science
Discuss how you would network a university with two campuses, taking into account the various sections of that campus (computer labs, health clinic, offices, security post, etc), discussing the choice of technologies, devices, topology/topologies, network types, protocols and anything else you would use and justifying your choices
In: Computer Science
For the prelab assignment, you may not use the if statement nor may you use the if/else statement. You are to write a program that calculates factorials from 1 up to and including a maximum number given by the user. Because factorials get large quickly, use long unsigned int as the type for the number entered by the user as well as the factorials you are calculating. If the user enters a 0, print an error message. Then ask if the user wishes to continue the program or quit.
In: Computer Science
Suggest one or more analysis pattern for the following application domains: PLEASE DO NOT HAND WRITE THE ANSWER!! PLEASE ANSWER ALL PARTS OF THE QUESTION!!
A) Accounting Software
B) Email software
C) Internet Browsers
D) Word - Processing software
E) Website creation software
In: Computer Science
Q#1: Take a real-world scenario and Implement it in
C++ program. Your program
should consist of the following:
1. Constructors
2. Pointers
3. Private and Public keywords
4. Reference by return
5. Const keyword
6. Passing Object as argument
In: Computer Science
IN PYTHON 3 LANGUAGE
Define a recursive function named immutify; it is passed any data structure that contains int, str, tuple, list, set, frozenset, and dict values (including nested versions of any of these data structures as an argument). It returns an immutable equivalent data structure (one that could be used for values in a set or keys in a dict). The types int, str, and frozenset are already immutable. Convert a set to a frozenset; convert all the values in a tuple to be their immutable equivalents, in the same order); convert a list to a tuple (with immutable equivalents of its values, in the same order); convert a dict to tuple of 2-tuples (see the association tuple in question 2) but here with the 2-tuples sorted by the dict’s keys. If immutify ever encounters a value of another type (e.g., float) it should raise a TypeError exception.
The following call (with many mutable data structures)
Example 1:
immutify( {'b' : [1,2], 'a' : {'ab': {1,2}, 'aa' : (1,2)}} )
returns the immutable data structure
(('a', (('aa', (1, 2)), ('ab', frozenset({1, 2})))), ('b', (1, 2)))
Example 2:
immutify( [{1,2}, {3,frozenset([4,5])}, {6,7}])
Returns
(frozenset({1, 2}), frozenset({3, frozenset({4, 5})}),
frozenset({6, 7}))
In: Computer Science
Please use R studio
Dataset: IBM HR Analytics Employee Attrition & Performance dataset (you can download the dataset from kaggle)
|
Name |
Description |
|
ATTRITION |
Employee leaving the company (0=no, 1=yes) |
|
BUSINESS TRAVEL |
(1=No Travel, 2=Travel Frequently, 3=Tavel Rarely) |
|
DEPARTMENT |
(1=HR, 2=R&D, 3=Sales) |
|
EDUCATION FIELD |
(1=HR, 2=LIFE SCIENCES, 3=MARKETING, 4=MEDICAL SCIENCES, 5=OTHERS, 6= TEHCNICAL) |
|
GENDER |
(1=FEMALE, 0=MALE) |
|
JOB ROLE |
(1=HC REP, 2=HR, 3=LAB TECHNICIAN, 4=MANAGER, 5= MANAGING DIRECTOR, 6= REASEARCH DIRECTOR, 7= RESEARCH SCIENTIST, 8=SALES EXECUTIEVE, 9= SALES REPRESENTATIVE) |
|
MARITAL STATUS |
(1=DIVORCED, 2=MARRIED, 3=SINGLE) |
|
OVER 18 |
(1=YES, 2=NO) |
|
OVERTIME |
(0=NO, 1=YES) |
The Variable Attrition is what we plan to use as our dependent variable. The variable contains a Yes if they stay with IBM and ‘No’ if they do not. We need to create this into a binary dummy variable with 0 if they do not stay with IBM (Attrition = ‘No’) and 1 if they do stay with IBM (Attrition = ‘Yes’). This will also need to be done to the variable Gender and OverTime. Gender we can assign “Male” to zero and “Female” to one. For OverTime we will assign 0 for “No” and 1 for “Yes”.
Create Pivot tables instead of correlation matrixes for categorical variables and do the data analysis.
For data analysis:
Describe the data using the techniques above (e.g. “We can see in this scatter plot that there is a positive correlation between the number of hours in which the patient exercised per week and his/her weight loss.”). About one page without the images.
Based on these observations, draw some insights. (e.g. “We believe the patient is burning calories when exercising, thus contributing to the loss of weight”). About one page.
State actionable experiments based upon your insights. (e.g. “We will use multiple regression that includes hours exercised as an explanatory variable to model weight loss. We expect…”)
In: Computer Science
Considering the following different search trees, binary search trees, AVL trees, red-black trees, and others. Compare their advantages and disadvantages, running times, etc
In: Computer Science
In: Computer Science
USING JAVA, PLEASE MAKE THIS AS SIMPLE AS POSSIBLE, THIS IS AN INTRODUCTORY JAVA COURSE
1. Design and implement a class called PairOfDice.
The class should include:
a. A non-default constructor, i.e. with parameters
b. A setter method for each instance data
c. A getter method for each instance data
d. A method roll() that rolls both dice
e. A toString() method that returns a string containing the colors of both dice, eg "Colors of both dice: Red,Blue "
f. A method pairSum that returns the current sum of the two die values. (in PairOfDice.java)
2. Write an application TestPairDice that uses the PairOfDice class to create a pair of dice. The application prints to the screen the sum of their face values. The program then rolls the pair of dice and prints to the screen the new sum of their face and the colors of both dice. (TestPairOfDice.java)
SAMPLE OUTPUT: Sum of face values before roll: 7
Sum of face values after roll: 6
Color of both dice: Red,Blue
In: Computer Science
In: Computer Science
Q1. a. Illustrate mathematically how to convert the following Binary number into Decimal Number system.
101112 = ?10
(11.10)2= ?10
(100011.011)2 = ?10
______________________________
b. Illustrate mathematically how to convert following decimal number into binary Number system.
(345)10 = ?2
(45.25)10 = ?2
______________________________
c. Illustrate mathematically how to convert the following Octal number into Decimal Number system.
278 = ?10
308 = ?10
______________________________
d. Illustrate mathematically how to convert the following Hexadecimal number into Decimal Number system.
(2F)16 = ?10
(BCC)16 = ?10
(2F. A2)16 = ?10
______________________________
e. Illustrate mathematically how to convert following Binary number into Octal Number system.
101012 = ?8
(11100.11)2= ?8
______________________________
f. Illustrate mathematically how to convert the following Binary number into Hexadecimal Number system.
101012 = ?16
(11100.11)2= ?16
(100011.011)2 = ?16
_______________________________
g. Solve and write the result of sum for given hexadecimal number
B D 5
+ A A B
--------------------
A D 5
+ F E C
--------------------
Solve and write the result of subtraction for given hexadecimal number
B D 5
- A A B
--------------------
B C 9
- E F C
--------------------
- A F 4
A B C
--------------------
In: Computer Science
In: Computer Science
In: Computer Science
Pringle et al (2015) experimentally examined the effects of fire and herbivory by elephants on the density of geckos that live in trees in Kenya, using 4 ha study plots. They excluded elephants from half of the plots and left the other half unfenced. Then they burned the vegetation in half of the plots and left the other half unburned (see sketch below). Each treatment was replicated once in three different areas used as blocks: Central, North and South. Four months after the treatments were applied, the researchers estimated the density of the gecko species Lygodactylus keniensis in each plot (number of individuals / m2 ).
| Block | Elephant Treatment | Fire Treatment | July 2013 lizard density per ha | |
| Central | Elephants present | Burned | 853.33 | |
| Central | Elephants present | Unburned | 183.33 | |
| Central | No elephants | Burned | 270 | |
| Central | No elephants | Unburned | 256.67 | |
| North | Elephants present | Burned | 784.44 | |
| North | Elephants present | Unburned | 298.89 | |
| North | No elephants | Burned | 417.78 | |
| North | No elephants | Unburned | 212.22 | |
| South | Elephants present | Burned | 661.11 | |
| South | Elephants present | Unburned | 356.67 | |
| South | No elephants | Burned | 380 | |
| South | No elephants | Unburned | 388.89 |
Using R, calculate the standard deviations of the four treatments
In: Computer Science