Questions
Create a C++ integer linked list program that performs the following methods below: Please create these...

Create a C++ integer linked list program that performs the following methods below:

Please create these three source files: intList.h, intList.cpp, & intListTest.cpp.

Implement recursive routines in the intList class to do the following:

  • Print the list in reverse order
  • Return the value in the middle node
  • Return the average of all the odd values
  • Remove every node containing an odd value

Modify main (in IntListTest.cpp) so it does the following:

  1. Insert the numbers 1, 3, 4, 6, 7, 10, 15, 20, 33.
  2. Find the sum of all values.
  3. Print the list in reverse order.
  4. Print the value of the middle node.
  5. Print the average of all the odd values.
  6. Remove every node containing an odd value.
  7. Print the list in reverse order.
  8. Print the value of the middle node.

Steps 3-8 must use recursion.

Please follow requirements.

In: Computer Science

You are intrigued by Fortune’s annual list of the 100 best companies to work for. Although...

You are intrigued by Fortune’s annual list of the 100 best companies to work for. Although it’s a long shot, you decide that you want to work for one of them. You read the good news that many of them are hiring, so you begin searching for a company that has possibilities for you. After narrowing the list, you hone in on one that seems like the best fit.

Your Task. Select a company from Fortune’s list of 100 best companies to work for. It may be a dream, but you are curious about working there. Note the reasons Fortune added this company to the list, and note the company’s ranking out of 100. Then review the company’s website and gather information about the company’s mission and goals, history, products, services, and current news releases. Find out where the home office is located, who leads the company, and how many employees work there. After researching the company, list your reasons for wanting to work there. In a memo report to your instructor, summarize your research findings. State the purpose, add appropriate section headings, and conclude with your thoughts on why you think this company is a good employment choice.

In: Economics

Arrays Question: You need to read in and process the wind speeds in East London over...

Arrays Question:
You need to read in and process the wind speeds in East London over the past few days. The maximum number of days are 8. Implement the methods listed below. Then use these methods effectively to read in the marks wind speeds and display the minimum and maximum speeds. You may not change any methods – including their parameters. static public int getValidNumber(int a, int b)
//Returns a number between a and b – including a and b
//You may assume that a <= b static public void ReadSpeedsIntoArray (int[] list, ref int NrEl)
// Reads wind speeds into an array. Request from the user how many
// wind speeds need to be read in. At least 4 speeds must be read
// in, but not more than 10. A speed cannot be negative or higher
// than 150. static public void getMinMax (int[] list, int NrEl, out int Min, out int Max )
// Returns the minimum and the maximum wind speed recorded in list static public void displayMinMax (int[] list, int NrEl)
// Displays the minimum and maximum wind speeds recorded in list

it's C# language

In: Computer Science

Write a Java program with comments that randomly generates an array of 500,000 integers between 0...

Write a Java program with comments that randomly generates an array of 500,000 integers between 0 and 499,999, and then prompts the user for a search key value. Estimate the execution time of invoking the linearSearch method in Listing A below. Sort the array and estimate the execution time of invoking the binarySearch method in Listing B below. You can use the following code template to obtain the execution time:

long startTime = System.currentTimeMillis();

perform the task;

long endTime = System.currentTimeMillis();

long executionTime = endTime - startTime;

A. Linear Search

public static int linearSearch(int[] list, int key) {

for (int i = 0; i < list.length; i++) {

if (key == list[i]) return i;

}

return -1;

}

B. Binary Search

public static int binarySearch(int[] list, int key) {

int low = 0;

int high = list.length - 1;

while (high >= low) {

int mid = (low + high) / 2;

if (key < list[mid])

high = mid - 1;

else if (key == list[mid])

return mid;

else

low = mid + 1;

}

return –low - 1; // Now high < low, key not found

}

In: Computer Science

IN PYTHON Create a function called biochild.  The function has as parameters the number m...

IN PYTHON

Create a function called biochild.
 The function has as parameters the number m and the lists biomother and biofather.
 The biomother and biofather lists contain 0’s and 1’s.
 For example: biomother = [1,0,0,1,0,1] and biofather = [1,1,1,0,0,1]
 Both lists have the same length n.
 The 0's and 1's represent bits of information (remember that a bit is 0 or 1).
 The function has to generate a new list (child).
 The child list must have the same length n.
 child is generated by randomly combining part of the child's information
biomother and biofather.
 The first part of the child list will be made up of the first b bits of biomother
and the second part by the last n-b bits of the biofather.
 For example, if b = 3, biomother = [1, 0, 0, 1,0,1] and biofather = [1,1,1, 0, 0, 1],
then child = [1,0,0,0,0,1].
 The value b has to be chosen randomly by the function.
 After generating child, each bit in the list is considered for mutation.
 For each bit of child, with probability m the bit is “mutated” by being replaced by its inverse
(If the bit is 0 it is replaced by 1, and if it is 1 it is replaced by 0).

 Finally, the function returns the list child.

In: Computer Science

Write the following Python script: Imagine you live in a world without modules in Python! No...

Write the following Python script:

Imagine you live in a world without modules in Python! No numpy! No scipy! Write a Python script that defines a function called mat_mult() that takes two lists of lists as parameters and, when possible, returns a list of lists representing the matrix product of the two inputs. Your function should make sure the lists are of the appropriate size first - if not, your program should print “Invalid sizes” and return None. Note: it is actually tricky to make a useful list of zeros. For instance, if you need to start with a 5 row, 6 column double list of 0, you might be tempted to try:

'''

thing = [ [ 0 ] ∗ 6 ] ∗ 5

'''

and if you look at it in the console window, it would appear to be a 5 by 6 list of lists containing all zeros! However - try the following and see what happens:

'''

thing [ 2 ] [ 5 ]

thing

'''

Notice that the item in index 5 of every row has changed, not just the row with index 2! Given the difficulty, I will give you the line of code that will create a list of lists that is num_rows by num_cols:

'''

ans = [ [ 0 for col in range ( num_cols ) ] for row in range ( num_rows ) ]

'''

In: Computer Science

This is an intro to python question. #Write a function called search_for_string() that takes two #parameters,...

This is an intro to python question.

#Write a function called search_for_string() that takes two
#parameters, a list of strings, and a string. This function
#should return a list of all the indices at which the
#string is found within the list.
#
#You may assume that you do not need to search inside the
#items in the list; for examples:
#
# search_for_string(["bob", "burgers", "tina", "bob"], "bob")
# -> [0,3]
# search_for_string(["bob", "burgers", "tina", "bob"], "bae")
# -> []
# search_for_string(["bob", "bobby", "bob"])
# -> [0, 2]
#
#Use a linear search algorithm to achieve this. Do not
#use the list method index.
#
#Recall also that one benefit of Python's general leniency
#with types is that algorithms written for integers easily
#work for strings. In writing search_for_string(), make sure
#it will work on integers as well -- we'll test it on
#both.


#Write your code here!

#Below are some lines of code that will test your function.
#You can change the value of the variable(s) to test your
#function with different inputs.
#
#If your function works correctly, this will originally
#print: [1, 4, 5]
sample_list = ["artichoke", "turnip", "tomato", "potato", "turnip", "turnip", "artichoke"]
print(search_for_string(sample_list, "turnip"))

In: Computer Science

Question 1: Processing Compound Data: Binary Trees A binary tree is a tuple with the following...

Question 1:

Processing Compound Data: Binary Trees

A binary tree is a tuple with the following recursive structure  

("btree", [val, left_tree, right_tree])

where first part of the tuple is a string "btree" and second part of the tuple is a list in which val is the value at the root and left_tree and right_tree are the binary trees for the left and right children or

("btree",[]) for the empty tree.  

(A)

Implement a binary tree ADT.

Type Name Description

Create the following tree in python. Use this tree to test the above functions of the tree ADT.

(B)

Implement the functions preorder,inorder and postorder.

Function preorder takes a tree as an argument and returns a list with the root value being the first element in the list followed by the elements of the left tree and then right tree. Function inorder takes a tree as an argument and returns a list with the elements of the left tree, followed by the root value and then right tree.

Function postorder takes a tree as an argument and returns a list with the elements of the left tree, followed by the elements of the right tree and then root value.

For example

preorder(t1) => [7, 5, 11, 9]

inorder(t1) => [5, 7, 9, 11]

postorder(t1) =>[5, 9, 11, 7]

In: Computer Science

Write the following Python script: Imagine you live in a world without modules in Python! No...

Write the following Python script:

Imagine you live in a world without modules in Python! No numpy! No scipy! Write a Python script that defines a function called mat_mult() that takes two lists of lists as parameters and, when possible, returns a list of lists representing the matrix product of the two inputs. Your function should make sure the lists are of the appropriate size first - if not, your program should print “Invalid sizes” and return None. Note: it is actually tricky to make a useful list of zeros. For instance, if you need to start with a 5 row, 6 column double list of 0, you might be tempted to try:

'''

thing = [ [ 0 ] ∗ 6 ] ∗ 5

'''

and if you look at it in the console window, it would appear to be a 5 by 6 list of lists containing all zeros! However - try the following and see what happens:

'''

thing [ 2 ] [ 5 ]

thing

'''

Notice that the item in index 5 of every row has changed, not just the row with index 2! Given the difficulty, I will give you the line of code that will create a list of lists that is num_rows by num_cols:

'''

ans = [ [ 0 for col in range ( num_cols ) ] for row in range ( num_rows ) ]

'''

In: Computer Science

A Pre-School teacher has created a new curriculum for teaching students new words. The new curriculum...

A Pre-School teacher has created a new curriculum for teaching students new words. The new curriculum is denoted as curriculum A and the original curriculum is denoted as curriculum B. The teacher instructs one class under curriculum A and a separate class under curriculum B. The number of new words each student learns is recorded and the teacher constructs a confidence interval for: ua-ub. The 95% t-confidence interval obtained is (1.26, 4.78).

(i) Based on the confidence interval the teacher constructed, do students learn the same number of words on average under curriculums A and B? Explain how you reached your conclusion. (ii) Interpret the confidence interval in words.

(iii) What requirements are needed for the above confidence interval to be valid?

In: Statistics and Probability