In: Computer Science
Please Use your keyboard (Don't use handwriting)
CS141
I need new and unique answers, please. (Use your own words, don't copy and paste)
Q1:
Show all the steps of the following data set when it being sorted with Insertion, Selection, and Merge Sort Algorithms. Then, calculate the performance of each one of them.(Big –O Notation)
|
18 |
4 |
26 |
9 |
21 |
15 |
20 |
10 |
Q2:
Write a program using LinkedList and ListIterator to obtain the following statements:
1. Create a linked list named "list" with these elements: "one", "four" "three", and “five.
2. Create a List Iterator named "iter1" related to "list".
3. Add the new element "two" after the element "one"
4. Remove the element "four" and “five”
5 Display all element of the list
6. Create a new List Iterator named "iter2" related to "list", to add new elements in the second, fourth and sixth positions and to create each new element you must use the value of the current element concatenated to " and a half". The new obtained list is: [one, one and a half, two, two and a half, three, three and a half]
Output sample:
[one, four, three, five]
[one, two, three]
[one, one and a half, two, two and a half, three, three and a half]
Q3:
a) Write the java code for doing a Linear Search on the array given below.
{24,2,45,20,56,75,2,56,99,53,12}
b) What would your search method return if we asked to search for the number 2 and return it’s index position?
In: Computer Science
python 3
We would like to add cursor-based APIs to the array-backed list API. To this end, we are including a cursor attribute, and two related methods. cursor_set will set the cursor to its argument index, and cursor_insert will insert its argument value into the list at the current cursor position and advance the cursor by 1.
E.g, given an array-backed list l that contains the values [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], running the following code
l.cursor_set(5)
l.cursor_insert('a')
l.cursor_insert('b')
l.cursor_insert('c')
will result in the updated list [0, 1, 2, 3, 4, 'a', 'b', 'c', 5, 6, 7, 8, 9]
When the cursor is set to the length of the list, cursor_insert should behave like append.
Programming rules:
class ArrayList:
def __init__(self):
self.data = []
self.cursor = 0
def append(self, val):
self.data.append(None)
self.data[len(self.data)-1] = val
def cursor_set(self, idx):
self.cursor = idx
def cursor_insert(self, val):
# YOUR CODE HERE
In: Computer Science
in java
This class will require the following fields:
Your LinkedList class must also support the following public methods.
In: Computer Science
Using java:
Implement a basic doubly-linked list that implements a priority system sorting the elements that are inserted. Sort based on the speed of the warrior.
Driver code:
public class LinkedListDriver {
public static void main(String[] args) {
LinkedList list = new SortedDoublyLinkedList();
System.out.println(list);
Warrior krogg = new Warrior("Krogg", 30, 50, 200);
list.insert(krogg);
System.out.println(list);
Warrior gurkh = new Warrior("Gurkh", 40, 45, 180);
list.insert(gurkh);
System.out.println(list);
Warrior brynn = new Warrior("Brynn", 45, 40, 190);
list.insert(brynn);
System.out.println(list);
Warrior dolf = new Warrior("Dolf", 20, 65, 210);
list.insert(dolf);
System.out.println(list);
Warrior zuni = new Warrior("Zuni", 50, 35, 170);
list.insert(zuni);
System.out.println(list);
}
}
Warrior class:
public class Warrior {
private String name;
private int speed;
private int strength;
private int hp;
public Warrior(String name, int speed, int str, int hp) {
this.name = name;
this.speed = speed;
this.strength = str;
this.hp = hp;
}
public String getName() { return this.name; }
public int getSpeed() { return this.speed; }
public int getStrength() { return this.strength; }
public int getHp() { return this.hp; }
public String toString() { return this.name + "(" +
this.speed + ")"; }
}
Class that needs to be done:
interface LinkedList {
void insert(Warrior warrior);
String toString();
}
Expected output:
[ Zuni(50) Brynn(45) Gurkh(40) Krogg(30) Dolf(20) ]
In: Computer Science
In: Computer Science
When a magnet is plunged into a coil at speed v, as shown in the figure, a voltage is induced in the coil and a current flows in the circuit. (Figure 1)

Part A
If the speed of the magnet is doubled, the induced voltage is ________.
In: Physics
When a magnet is plunged into a coil at speed v, as shown in the figure, a voltage is induced in the coil and a current flows in the circuit. (Figure 1)

Part A
If the speed of the magnet is doubled, the induced voltage is ________.
a.) twice as great
b.) four times as great
c.) half as great
d.) unchanged
In: Computer Science
Two 2.0 cm ×2.0 cm square aluminum electrodes, spaced 0.80 mm apart, are connected to a 200 V battery.
Part A---- What is the capacitance? Express your answer in picofarads.
Part B ----What is the charge on the positive electrode? Express your answer in coulombs.
In: Physics
What is methyl mercury? II. Sources of Methyl Mercury? III. Health concerns and potential receptors? IV. Susceptibility ? V. Remediation? VI. Long term effects? VII. Existing studies and guidelines? VIII. Risk? IX. Is the trade off worth it? We need energy.?
In: Chemistry