R-Studio (R Programming Language)
1. How would you create a vector `V` containing the values 0,
0.25, 0.5, 0.75, and 1?
```{r}
#insert your code
```
2. Name the elements of `V`: first, second, middle, fourth, last.
Describe two ways of naming elements in `V`
```{r}
#insert your code
```
3. Suppose you keep track of your mileage each time you fill up.
At your last 6 fill-ups the mileage was
65311 65624 65908 66219 66499 66821 67145 67447. Enter these
numbers into R as vector `miles`. Use the function `diff` on the
data `miles`. What does it give? Use `sum` on the computed
differences to find the total travelled distance.
```{r}
#insert your code
```
In: Computer Science
Argue analytically that a completely impure node yields the highest Gini Impurity.
In: Computer Science
6)True/False with explanations:
a.In KNN, the complexity of the model space can be tuned to account
for more complex decision boundaries by decreasing K.
b.If Margin(Model 1)>Margin(Model 2) on the same data, Model 1
will perform better on unseen data.
c.Perceptron minimizes training error when the data is linearly
separable.
In: Computer Science
Assume thatthe table EMP hasthe following data EmpNo Surname Firstname 1 Smith Fred 2 Jay Emma 2 Phelps Mark Consider the following statement: SELECT Firstname || ' ' || Surname FROM Employee What is displayed?
In: Computer Science
Docker containers can be considered a new era of virtualization that has fundamentally changed the IT industry. For this discussion question, provide a brief response that describes a Docker container and how a container differs from a hypervisor.
In: Computer Science
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words
Question 4: Recall the problem in which you have k sorted array each of size n, which need to make one single sorted array. Find another fast way to unite the arrays that does not use Priority Queue.
In: Computer Science
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words
Question 5: Five an efficient data structure supporting the following operations. Insert(S, x), Delete−M ax(S), and Delete−1000 th(S) which deletes from H the 100 largest element in the structure. Assume that the number of elements is more than 100. Also assume that the numbers are pairwise distinct and so the 100”th largest element is well defined.
In: Computer Science
Write a response to the following in a minimum of 175
words.
What is virtualization and its benefits?
Why has virtualization become almost necessary in today's business
environment? Other than the cost of hardware and the lack of effort
required to virtualize software, why businesses might decide to use
virtualization?
In: Computer Science
Compare and Contrast peer-to-peer, client/server, and directory services networks. Be sure to specify the advantages and disadvantages along with how security is managed of each type of network. PLEASE DO NOT HAND WRITE THE ANSWER!! PLEASE ANSER THE QUESTION THOROUGHLY!! IF YOU CANNOT PROVIDE 1,000 WORDS DO NOT ANSWER THE QUESTION!!
In: Computer Science
Length: 1300 words
Task
Answer the following essay question:
"All technological change is a Faustian bargain. For every advantage a new technology offers, there is always a corresponding disadvantage"
Is this statement valid? Discuss Postman's observation
in the context of educational technology in contemporary Australian
higher education.
Postman, N. (1995). The end of education: Redefining the value
of school. New York: Alfred A. Knopf.
Overview and Advice
'Higher education' in this question refers to post-compulsory education. While some research may be relevant to K-12, the focus of your discussion should be further education including University, TAFE and trade training, as this raises different issues around motivation, goals and outcomes. Remember that we are interested in evidence-based practice, so statements about participation, attitudes, behaviour and outcomes should be supported with peer-reviewed research and demographic data.
Careful question analysis is important when approaching this essay. What does discuss mean? This topic is potentially broad, so you will need to plan carefully to ensure that your argument is clearly defined and follows a logical progression. Question your own assumptions, and those of the authors you are reading; look for opportunities to demonstrate critical thinking. Use good essay and paragraph structure, and demonstrate your understanding of referencing by supporting your argument with a wide selection of carefully chosen sources.
Important: We are interested in investigating the pros and cons of technology in education; this essay is not about Postman’s broader views, or his work; only the statement presented in the question (which should be mentioned in your introduction).
In: Computer Science
R.R.Word.file.R.R
(Main Focus of Cheg-Study!)
// this is the question below
You will create specific customer classes with specialized behaviors for a regular subscription and platinum
subscription. This will focus on the concepts of inheritance and polymorphism.
Main objective. This will consist of four classes: Customer, RegularCustomer, PlatinumCustomer, and
Tester (or any name you’d prefer for the main method file). The Customer class will have a
name and type. The RegularCustomer and PlatinumCustomer classes will inherit both of these
fields from the Customer class. The PlatinumCustomer class will also have a discount field. The
methods for each of these classes will be the following:
Customer
* Customer (constructor)
* setName
* setType
* getName
* getType
* toString
RegularCustomer:
* RegularCustomer (constructor)
* toString
PlatinumCustomer
* PlatinumCustomer (constructor)
* setDiscount
* getDiscount
* toString
For the RegularCustomer and PlatinumCustomer constructors, the type of subscription should
be set to “regular” or “platinum". Each of these two constructors should also take
advantage of inheritance when setting the fields. Given a name of “David” and a type of
“regular”, the toString method for Customer and RegularCustomer should print the following:
David has a regular subscription.
The toString method for PlatinumCustomer should also include the discount. Assume a discount
of 7% for the following:
David has a platinum subscription. The current discount on purchases for this subscription is
7.0%.
In the Tester class, make a main method where you create a Customer reference variable. Ask
the user to input a type. If the user enters “regular” for the type, ask for the name and construct
a RegularCustomer object. If the user enters “platinum” for the type, ask for the name and a
discount and then construct a PlatinumCustomer object. Finally, print this created object
to the console.
Take note of one issue with this design. RegularCustomer and
PlatinumCustomer both inherit setType from Customer, but the user should never be able to
change the type for either of these subclasses. Implement an overriding setType for each of
these two subclasses that prevents the type from being changed.
The workflow of the main method should be similar to the following:
For a Regular Subscription;
run:
Please enter a type: regular
Please enter a name: David
David has a regular subscription.
Build successful (total time: 6 seconds)
For a Platinum Subscription;
Please enter a type: platinum
Please enter a name: David
Please enter a discount: 7
David has a platinum subscription.
The current discount on purchases for this subscription is 7.0%
Build successful (total time: 6 seconds)
(End of Work Cheg-Study!)
In: Computer Science
1) If c is type char and i type int, what is assigned to c and i?
Give answers in hex. Assume c is one byte, and i is four
bytes. Explain.
c = 240;
i = c;
2) If c is type unsigned char and i type int, what is assigned to
c and i? Give answers in hex. Explain
c = 240;
i = c;
3) If c is type signed char and i type int, what is assigned to
c and i? Give answers in hex. Explain
c = 240;
i = c;
In: Computer Science
Exercise 4: Perform the following on the Account class and test it in the AccountArrayTest: In the AccountArrayTest class, add a static method called getAverageBalance (Account accounts[]) that returns the average balance of all accounts. Use the enhanced for loop. In the main method get and print the average accounts balance. Add an instance method called deposit() that takes a double amount as parameter and if it is positive it adds it to the current balance. If the amount is less than or equal to zero it does nothing. Add a static method called addInterest(Account accounts[]) that calculates the interest for each account in the accounts array (based on the interestRate value), and then deposits it into the relevant account in that array. (Hint: interest = interestRate * balance/100). Use the above methods to apply the addInterest() for all the accounts in your AccountArrayTest. Print the accountNo and balance after the update.
In: Computer Science
Complete this javascript question according to the
instructions
given in the comments.
*** DO NOT CHANGE any of the code that you are not instructed to. */
////////////////////
// Hint: If you see a console.log() in my examples, it is
// likely a "return" goes there in your assignment.
///////////////////
// 1) Define a "Vehicle" class that has a "wheels" property
equal to 4 in
// the constructor and a method named "rolling" that returns a
string
// equal to "Rolling down the highway on {wheels value}
wheels."
// Use the class to instantiate a new object named myRide.
// Define a "Car" subclass based on the parent class
"Vehicle".
// The "Car" class should also accept a parameter "carDoors".
The
// "Car" class should have a "doors" property that is set to
the
// value of the "carDoors" parameter. Add a method named
"doorsAndWheels"
// that returns a string equal to "My car has {doors value} doors
and
// {wheels value} wheels."
// Use the "Car" class to instantiate a new object named
myCruiser.
// Define a "Pie" class with the properties "flavor" and
"slices".
// Set the "flavor" property equal to a parameter named
"pieFlavor".
// Set the "slices" property equal to 8. Add a "getSlices"
method
// and a "setSlices" method that function as expected.
// Use the "Pie" class to instantiate a new object named
myDessert
// Define a Factory Function named "iceCreamFactory" that
// accepts a "iceCreamFlavor" parameter.
// The function will create an object that has a "flavor"
// property which is private. Set the "flavor" property
// value to the parameter "iceCreamFlavor" value.
// The function should also add a public "cone" property
// that has the value "waffle".
/////////////////////
// The factory function should add a method to the object
// it creates called "serve" that returns a string:
// "Here's your { flavor } ice cream in a { cone } cone."
///////////////////
// Hint: Look at this week's image for Factory Functions
////////
// Use iceCreamFactory to instantiate an object named myScoop.
// Using a literal (not a class or function), define an
object
// named "webDev" that has the following key-value pairs:
// foundation: "html", design: "css", logic: "javascript",
// build: function(){return "building..."}
// Convert the "webDev" object to JSON, and save the
converted
// data in a variable named sendJSON.
// Now convert the sendJSON data back to an object
// named receiveJSON.
In: Computer Science
Add your own method (or use one or more of the existing methods) to insert the following set of numbers (1, 5, 19, 7, 23, 17, 2) in a linked list (use one function call per number, and preserve the order of insertion). Once inserted print the linked list such that the output displays the numbers in reverse order. (2, 17, 23, 7, 19, 5, 1)
package linkedlist_app;
//-------class with main()-------------------
public class LinkedList_App {
public static void main(String[] args) {
linkedList myLL = new
linkedList();
System.out.println("----------------------------------");
//check for problems:
myLL.delete('A');
myLL.print();
myLL.insert_at_begining('A');
myLL.insert_after('X', 'A');
myLL.insert_at_end('E');
myLL.print();
myLL.delete('A');
myLL.print();
System.out.println("----------------------------------");
System.out.println("-- Free ALL
Nodes ----------------");
myLL.freeAll(); myLL.print();
System.out.println("----------------------------------");
System.out.println("--Insert at
begining: A, B, C ----");
myLL.insert_at_begining('A');
myLL.insert_at_begining('B');
myLL.insert_at_begining('C');
myLL.print();
}
}
//--------aNode
class---------------------------------------------
class aNode {
char data;
aNode next;
aNode(char mydata) { // Constructor
data = mydata;
next = null;
}
}
//------linkedList
class-----------------------------------------------
class linkedList {
aNode head; // Head of the linked list
aNode tail; //*** Tail of the linked list
int size;
linkedList() { // Constructor
head = null;// head point to
null
tail=null;//***tail also must point
to null
size =0;
}
//-----------------------------------------------------
public void insert_at_begining(char value)
{
aNode newNode = new aNode(value);
// create aNew node
if(isEmpty()){//***if the node is
inserted in empty node then head and tail are same
tail=newNode;
}
newNode.next = head;
head = newNode;
size++;
}
//-----------------------------------------------------
public void insert_at_end(char value) {
aNode newNode = new aNode(value);
// create aNew node
if (isEmpty())
{
insert_at_begining(value); //**reuse the code
already written
}else{ //**no
need to traverse the last node since reference of last node is in
tail
tail.next=newNode;
tail=newNode;
size++;
}
}
//-----------------------------------------------------
public void insert_after(char
value, char searchValue) {
if (isEmpty())
{
System.out.println("Linked List is empty, no way
to insert " + value + " after " + searchValue);
return;//***for simplicity of the code return
the control here
//***it eliminates complicated nested loop
}
//find the node
with searchValue
aNode
ptr;
boolean
found = false;
ptr =
head;
while (ptr
!= null && found == false) {
if (ptr.data == searchValue) {
found = true;
} else {
ptr = ptr.next;
}
}
if (ptr ==
null) {
System.out.println("Did not find " + searchValue
+ "Nothing Inserted");
return;//***for simplicity of the code return
the control here
//***it eliminates complicated nested loop
}
aNode newNode =
new aNode(value); // create aNew node
newNode.next =
ptr.next;
ptr.next =
newNode; //add the node after the searchValue
if(newNode.next==null)//***it is the last node
tail=newNode; //***point tail to the last
node
size++;
}
//-----------------------------------------------------
// Delete the first node with the
value
public void delete(char
deleteValue) {
if (isEmpty())
{
System.out.println("Linked List is empty,
nothing to delete");
return;//***for simplicity of the code return
the control here
//***it eliminates complicated nested loop
}
aNode
deletePtr = head; // create a reference to head
if
(head.data == deleteValue && head==tail) { //***only one
node in list
head = head.next; // remove the head and
tail=tail.next; //tail
deletePtr = null; // make the node available for
garbage collection.
size--;
return;//***for simplicity of the code return
the control here
//***it eliminates complicated nested loop
}
if(head.data==deleteValue){ //***first node to be deleted
head = head.next; // remove the head
deletePtr = null; // make the node available for
garbage collection.
size--;
return;//***for simplicity of the code return
the control here
//***it eliminates complicated nested loop
}
aNode
prevPtr;
deletePtr =
prevPtr = head;
boolean found =
false; //find the value to be deleted
while (deletePtr
!= null && found == false) {
if (deletePtr.data == deleteValue) {
found = true;
prevPtr.next =
deletePtr.next;
if(deletePtr.next==null)//***last node is deleted
tail=prevPtr;
deletePtr = null; // make
deletePtr available to garbage collection
size--;
} else {
prevPtr = deletePtr;
deletePtr =
deletePtr.next;
}
}
if (found ==
false) {
System.out.println("Not able to find/delete " +
deleteValue + " in the Linked List");
}
}
//-----------------------------------------------------
public boolean isEmpty() {
return
head==null;//***single line can work to check whether linked list
is empty or not
}
//-----------------------------------------------------
public void print() {
aNode ptr;
ptr =
head;
System.out.print("Head--> ");
while (ptr !=
null) {
System.out.print(ptr.data + " --> ");
ptr
= ptr.next;
}
System.out.println("NULL");
}
//-----------------------------------------------------
public int getSize() {
return(size);
}
//-----------------------------------------------------
public void freeAll() {
aNode freePtr =
head;
while(head !=
null) {
head = head.next; // the next two lines are
unnecessary, but are included for
// illustration of how memory is freed up
// freePtr = null;
// make the node available for garbage
collector
freePtr = head; // now let the freePtr to the
new head
}
head =
null;
size = 0;
}
}
//##############################################
//NOTE:- Changes made in the optimised code shown as *** in the
comment line
In: Computer Science