*****************PLEASE GIVE THE CODE IN RACKET PROGRAMMING ONLY AND MAKE SURE THE CODE RUNS ON WESCHEME IDE***************
Write a recursive Racket function "sum-diff" that takes two lists of integers that are the same length and evaluates to an integer. The resulting integer should be the sum of the absolute value of the differences between each pair of integers with the same index in the two lists. For example (sum-diff '(-1 -2 -3) '(1 2 3)) should evaluate to 12 because the absolute value of the differences between (-1 and 1), (-2 and 2) and (-3 and 3) are 2, 4, and 6, and 2+4+6=12. Note: (abs n) evaluates to the absolute value of n. Also, if the lists are empty the sum should be 0
In: Computer Science
Write a C program that demonstrate tree traversal.
A. first is to ask the user to enter data
B. ask how many nodes
THIS IS JUST A SAMPLE. PLEASE ANSWER IT IN COMPLETE CODE.
See for the sample output.
Sample Output:
How many node do you have in your tree : 5
Enter root: 20
if you want to add to the left press 0 otherwise press 1
answer: 0
Enter next node: 10
if you want to add to the left press 0 otherwise press 1
answer: 0
Enter next node: 8
if you want to add to the left press 0 otherwise press 1
answer: 0
Enter next node: 15
if you want to add to the left press 0 otherwise press 1
answer: 1
Enter next node: 21
Display tree
20
/ \
10 21
/
8
/
5
Preorder – 20, 10, 8, 5, 21
Inorder – 5, 8, 10, 20, 21
Postorder – 5, 8, 10, 21, 20
COMMENT CODE PLS....
In: Computer Science
g[8]=4[A[3j] + B[i+6j]
I and j are variables. When doing MIPS instructions for above statement what needs to be done to 4[A[3j]? Choose your own temporary and store registers. Explain show step by step
In: Computer Science
In: Computer Science
Give an algorithm for reversing a queue Q. Only following standard operations are allowed on queue. 1. enqueue(x) : Add an item x to rear of queue. 2. dequeue() : Remove an item from front of queue. 3. empty() : Checks if a queue is empty or not.. (Hint: you can use LinkedList, Stacks, and Queues from the java data collection)
OUTPUT Examples: Input : Q = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] Output :Q = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10] Input :[1, 2, 3, 4, 5] Output :[5, 4, 3, 2, 1]
In: Computer Science
(Machine learning Neural Network) Consider a regression Multilayer Perceptron (MLP) that uses identity activation functions for all neurons. A data scientist trains the neural network to minimize the MSE(Mean Squared Error), and he observes a much smaller training set MSE for the MLP as compared to that for OLS (Oridinary Least Squares). Is this possible? Justify your answer.
In: Computer Science
CMIS 320 Project 1
Write a justification paper, of at least 2 pages, to your boss
explaining how a relational database solution can be applied to a
current business problem or area for improvement. Assume that your
boss knows nothing about relational database theory. The goal of
this paper is to obtain your boss's approval to proceed with your
stated project. Do not focus on technical aspects of a database
management system. Focus on how the information will be captured,
manipulated, managed, and shared, and the value the database brings
to the organization. Include brief examples of how other industries
(both domestic and international) have successfully used relational
databases to increase efficiency.
In: Computer Science
Homework 5: Lists
Please show code in Pycharm
The task is to create the following three functions to demonstrate techniques for working with lists:
In: Computer Science
Discuss the advantages and disadvantages of using DHCP.
In: Computer Science
write code using Arduino to display the digits of pi(π) to the 20th decimal point on a 7-segment display. You code should include functions for all the digits, and your loop( ) should only call the functions to display the numbers. Delay 500ms between each number. Use macro definitions for the individual LED's.
In: Computer Science
One customer has sent you the following email to initiate a project.
“I need to make a report program manager using the internet data from internet system. I only need the data related to signal strength and customer satisfaction rating. I need to be able to sort this by state.” What are the followup questions, and what research you would do before meeting the program manager with the customer what information would you add on the requirement document.
In: Computer Science
use c++
This question is about providing game logic for the game of craps
we developed its shell in class. At the end of the game, you should
ask the user if wants to play another game, if so, make it happen.
Otherwise, quit
**Provide the working output of this game and the picture of the output. **
This is an implementation of the famous 'Game of Chance'
called 'craps'.
It is a dice game. A player rolls 2 dice. Each die has six faces:
1, 2, 3, 4, 5, 6.
Based on the values on the dice, we play the game until a player
wins or loses.
You add the values of the dice's face.
1) If the sum is 7 or 11 on the first roll, the player wins.
2) If the sum is 2, 3, or 12 on the first roll, the player loses (
or the 'house' wins)
3) If the sum is 4, 5, 6, 8, 9, or 10 on the first roll, then that
sum becomes the player's 'point'.
4)To win, the player must continue rolling the dice until he/she
'make the point'.
5)If the player rolls a 7 he/she loses.
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <random>
enum class Status { CONTINUE, WON, LOST};
unsigned int rollDiceAdvanced(); // same as above, but used advance
c++ Random Number generation.
// global variable to use in the advanced version
of RNG (Random number Generator)
std::default_random_engine engine{ static_cast<unsigned
int>(time(0)) };
std::uniform_int_distribution<unsigned int> randomInt{ 1, 6
};
int main()
{
Status gameStatus; // can be CONTINUE, WON, or
LOST
unsigned int myPoint{ 0 };
unsigned int sumOfDice = rollDiceAdvanced(); // first roll of dice.
// bellow the game logic: Provide the game logic
return 0;
}
// this is distribution based random number generation in c++
unsigned int rollDiceAdvanced()
{
unsigned int firstRoll{ randomInt(engine) };
unsigned int secondRoll{ randomInt(engine) };
unsigned int sum{ firstRoll + secondRoll };
std::cout << "rollDiceAdvance: " << sum
<< std::endl;
return sum;
}
In: Computer Science
Write a program to toss a coin multiple times. Ask the user for how many times to toss the coin and then display the percentage of heads and tails (do not display each toss, just the totals). JAVA
In: Computer Science
<?php # Script 10.5 - #5
// This script retrieves all the records from the users
table.
// This new version allows the results to be sorted in different
ways.
$page_title = 'View the Current Users';
line 6 include('includes/header.html');
echo '<h1>Registered Users</h1>';
require('mysqli_connect.php');
// Number of records to show per page:
$display = 10;
// Determine how many pages there are...
if (isset($_GET['p']) && is_numeric($_GET['p'])) { //
Already been determined.
$pages = $_GET['p'];
} else { // Need to determine.
// Count the number of records:
$q = "SELECT COUNT(user_id) FROM users";
$r = @mysqli_query($dbc, $q);
$row = @mysqli_fetch_array($r, MYSQLI_NUM);
$records = $row[0];
// Calculate the number of pages...
if ($records > $display) { // More than 1
page.
$pages = ceil
($records/$display);
} else {
$pages = 1;
}
} // End of p IF.
// Determine where in the database to start returning
results...
if (isset($_GET['s']) && is_numeric($_GET['s'])) {
$start = $_GET['s'];
} else {
$start = 0;
}
// Determine the sort...
// Default is by registration date.
$sort = (isset($_GET['sort'])) ? $_GET['sort'] : 'rd';
// Determine the sorting order:
switch ($sort) {
case 'ln':
$order_by = 'last_name ASC';
break;
case 'fn':
$order_by = 'first_name ASC';
break;
case 'rd':
$order_by = 'registration_date
ASC';
break;
default:
$order_by = 'registration_date
ASC';
$sort = 'rd';
break;
}
// Define the query:
$q = "SELECT last_name, first_name, DATE_FORMAT(registration_date,
'%M %d, %Y') AS dr, user_id FROM users ORDER BY $order_by LIMIT
$start, $display";
$r = @mysqli_query($dbc, $q); // Run the query.
// Table header:
echo '<table width="60%">
<thead>
<tr>
<th
align="left"><strong>Edit</strong></th>
<th
align="left"><strong>Delete</strong></th>
<th align="left"><strong><a
href="view_users.php?sort=ln">Last
Name</a></strong></th>
<th align="left"><strong><a
href="view_users.php?sort=fn">First
Name</a></strong></th>
<th align="left"><strong><a
href="view_users.php?sort=rd">Date
Registered</a></strong></th>
</tr>
</thead>
<tbody>
';
// Fetch and print all the records....
$bg = '#eeeeee';
79 while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC))
{
$bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee');
echo '<tr bgcolor="' . $bg .
'">
<td align="left"><a
href="edit_user.php?id=' . $row['user_id'] .
'">Edit</a></td>
<td align="left"><a
href="delete_user.php?id=' . $row['user_id'] .
'">Delete</a></td>
<td align="left">' .
$row['last_name'] . '</td>
<td align="left">' .
$row['first_name'] . '</td>
<td align="left">' .
$row['dr'] . '</td>
</tr>
';
} // End of WHILE loop.
echo '</tbody></table>';
92 mysqli_free_result($r);
mysqli_close($dbc);
// Make the links to other pages, if necessary.
if ($pages > 1) {
echo '<br><p>';
$current_page = ($start/$display) + 1;
// If it's not the first page, make a Previous
button:
if ($current_page != 1) {
echo '<a
href="view_users.php?s=' . ($start - $display) . '&p=' . $pages
. '&sort=' . $sort . '">Previous</a> ';
}
// Make all the numbered pages:
for ($i = 1; $i <= $pages; $i++) {
if ($i != $current_page) {
echo '<a
href="view_users.php?s=' . (($display * ($i - 1))) . '&p=' .
$pages . '&sort=' . $sort . '">' . $i . '</a> ';
} else {
echo $i . '
';
}
} // End of FOR loop.
// If it's not the last page, make a Next
button:
if ($current_page != $pages) {
echo '<a
href="view_users.php?s=' . ($start + $display) . '&p=' . $pages
. '&sort=' . $sort . '">Next</a>';
}
echo '</p>'; // Close the paragraph.
} // End of links section.
Line 124 include('includes/footer.html');
?>
==============================
Warning: include(includes/header.html): failed
to open stream: No such file or directory line
6
Warning: include(): Failed opening
'includes/header.html' for inclusion (include_path='.;C:\php\pear')
on line 6
Registered Users
Warning: mysqli_fetch_array() expects parameter 1
to be mysqli_result, boolean on line 79
Warning: mysqli_free_result() expects parameter 1
to be mysqli_result, boolean on line 92
Warning: include(includes/footer.html): failed to
open stream: No such file or directory on line
124
Warning: include(): Failed opening
'includes/footer.html' for inclusion (include_path='.;C:\php\pear')
on line 124
In: Computer Science
Write an application that asks the user for a natural number. Display all the natural numbers up to and including the user's input. Also display the sum of all those numbers. JAVA
In: Computer Science