Hello. Please answer the following two-part question in Scheme. Not Python, not any form of C, but in the language Scheme. If you do not know Scheme, please do not answer the question. I've had to upload it multiple times now. Thank you.
2.1 Write a recursive function called eval-poly
that takes a list of numbers representing the coefficients of a
polynomial and a value for ? and evaluates the polynomial for the
given value of ?. The list of coefficients should start with the
term of lowest degree and end with the term of highest degree. If
any term of intermediate degree is missing from the polynomial it
should have a coefficient of zero. For example, the polynomial
?3+4?2+2 would be represented by the list '(2 0 4 1). Hint: the
polynomial above can be rewritten as 2+?⋅(0+?⋅(4+?⋅1))
> (eval-poly '() 0)
0
> (eval-poly '(5) 0)
5
> (eval-poly '(4 3) 2)
10
> (eval-poly '(2 7 1) 3)
32
2.2 Write a tail-recursive version of the
previous problem called eval-poly-tail. It should call a helper
function called eval-poly-tail-helper that uses tail recursion to
keep a running sum of the terms evaluated so far. You might want to
use the expt function to take a number to a power.
> (eval-poly-tail '() 0)
0
> (eval-poly-tail '(5) 0)
5
> (eval-poly-tail '(4 3) 2)
10
> (eval-poly-tail '(2 7 1) 3)
32
Edit: If you can't answer my question then move along to allow someone who can to do so. Thanks.
In: Computer Science
Hello. Please answer the following two-part question in Scheme. Not Python, not any form of C, but in the language Scheme. If you do not know Scheme, please do not answer the question. I've had to upload it multiple times now. Thank you.
3.1 Write a recursive function called split
that takes a list and returns a list containing two lists, each of
which has roughly half the items in the original list. The easiest
way to do this is to alternate items between the two lists, so that
(split '(1 2 3 4 5)) would return '((1 3 5) (2 4)). I recommend
using two base cases: one for an empty list and the other for a
list containing one item.
> (split '())
(() ())
> (split '(3))
((3) ())
> (split '(4 8))
((4) (8))
> (split '(8 6 7 5 3 0 9))
((8 7 3 9) (6 5 0))
3.2 Write a recursive function called merge that
takes two sorted lists of numbers and merges them together into one
sorted list containing all of the number in both lists including
duplicates.
> (merge '() '())
()
> (merge '() '(1 2 3))
(1 2 3)
> (merge '(1 2 3) '())
(1 2 3)
> (merge '(2 4 7) '(1 3 5))
(1 2 3 4 5 7)
In: Computer Science
Case- IT Auditing
The SSO Server is a single purpose server solely designed for SSO and resides in the internal network. Using a batch process, the vendor provides quarterly updates which are downloaded directly to the server and automatically installed by the server’s single purpose operating system. Access to the SSO application is restricted to the security administration staff. The vendor maintains an active account on the server in the event maintenance is required. The vendor accesses the system periodically to review status and log activity to determine the server’s capacity and to proactively look for concerns prior to problems arising. A replication copy of the SSO Server exists as a backup and automatically assumes primary role if the main server stops functioning.
Question: What are the Controls and what are the GAPS
In: Computer Science
Assignment #1: Sorting with Binary Search Tree (IN C LANGUAGE)
Through this programming assignment, the students will learn to do the following:
1. Know how to process command line arguments.
2. Perform basic file I/O.
3. Use structs, pointers, and strings.
4. Use dynamic memory.
This assignment asks you to sort the lines of an input file (or from standard input) and print the sorted lines to an output file (or standard output). Your program, called bstsort (binary search tree sort), will take the following command line arguments: % bstsort [-c] [-o output_file_name] [input_file_name] If -c is present, the program needs to compare the strings case sensitive; otherwise, it's case insensitive. If the output_file_name is given with the -o option, the program will output the sorted lines to the given output file; otherwise, the output shall be the standard output. Similarly, if the input_file_name is given, the program will read from the input file; otherwise, the input will be from the standard input. You must use getopt() to parse the command line arguments to determine the cases. All strings will be no more than 100 characters long. In addition to parsing and processing the command line arguments, your program needs to do the following:
1. You need to construct a binary search tree as you read from input. A binary search tree is a binary tree. Each node can have at most two child nodes (one on the left and one on the right), both or either one can be empty. If a child node exists, it's the root of a binary search tree (we call subtree). Each node contains a key (in our case, it's a string) and a count of how many of that string were included. If he left subtree of a node exists, it contains only nodes with keys less than the node's key. If the right subtree of a node exists, it contains only nodes with keys greater than the node's key. You can look up binary search tree on the web or in your Data Structure textbook. Note that you do not need to balance the binary search tree (that is, you can ignore all those rotation operations) in this assignment.
2. Initially the tree is empty (that is, the root is null). The
program reads from the input file (or stdin) one line at a time; If
the line is not an empty line and the line is not already in the
tree, it should create a tree node that stores a pointer to the
string and a count of 1 indicating this is the first occurrence of
that string, and then insert the tree node to the binary search
tree. An empty line would indicate the end of input for stdin, an
empty line or end of file would indicate the end of
input for an input file. If the line is not an empty line and the
line is already in the tree, increase the count for that node
indicating that there are multiple instances of that line.
3. You must develop two string comparison functions, one for case sensitive and the other for case insensitive. You must not use the strcmp() and strcasecmp() functions provided by the C library. You must implement your own version. You will be comparing the ASCII values. Note that using ASCII, all capital letters come before all lower case letters.
4. Once the program has read all the input (when EOF is returned or a blank line encountered), the program then performs an in-order traversal of the binary search tree to print out all the strings one line at a time to the output file or stdout. Next to the line include a count of how many times that line appeared. If the selection was for case insensitive then you should include either the first choice encountered, the last choice encountered or all capital letters.
5. Before the program ends, it must reclaim the tree! You can do this by performing a post-order traversal, i.e., reclaiming the children nodes before reclaiming the node itself. Make sure you also reclaim the memory occupied by the string as well. 6. It is required that you use getopt for processing the command line and use malloc or calloc and free functions for dynamically allocating and deallocating nodes and the buffers for the strings. It is required that you implement your own string comparison functions instead of using the corresponding libc functions.
Here's an example:
bash$ cat myfile
bob is working.
david is a new hire.
Bob is working.
alice is bob's boss.
charles doesn't like bob.
bash$ ./bstsort myfile
1 alice is bob's boss.
2 bob is working.
1 charles doesn't like bob.
1 david is a new hire.
Please submit your work through the inbox as one zip file. Follow the instructions below carefully (to avoid unnecessary loss of grade): You should submit the source code and the Makefile in the zip file called FirstnameLastnameA1. One should be able to create the executable by simply 'make'.
The Makefile should also contain a 'clean' target for cleaning up the directory (removing all temporary files and object files). Make sure you don't include intermediate files: *.o, executables, *~, etc., in your submission. (There'll be a penalty for including unnecessary intermediate files). Only two files should be included unless permission is given for more, those would be bstsort.c, and Makefile. If you feel a need to include a bstsort.h file, please send me a note asking for permission.
In: Computer Science
Create a simple Graphical User Interface (GUI): Create new JFrameForm and use the Palette to drag and drop the Swing Containers and Controllers like the figure shown.
Your Form should accept a file name in its text field. When the user presses OK Button, the content of the String array appear in the Text area below.
Handle all Exceptions (File Not Found Exception)
GUI frame
In: Computer Science
JAVA!
Methods
void read_data()
Description: It handles the reading from the input and the storage of the above class properties
void write_data()
Description: It handles the writing to the output of the final tax return result
float adjusted_gross_income(float income)
Description: It returns the adjusted gross income
Logic: Adjusted gross income is what remains in the income after subtracting the social security and medicare taxes. Social security rate is 12.4%. Medicare is 2.9% but it only applies to the first $100K of the income. Both social security and medicare taxes are split equally between employer and employee.
In: Computer Science
List out the operation performed on HDD
In: Computer Science
SIGNS = '03,21-04,19=ARI;04,20-05,20=TAU;05,21-06,21=GEM;06,22-07,22=CAN;' + \
'07,23-08,22=LEO;08,23-09,22=VIR;09,23-10,23=LIB;10,24-11,20=SCO;' + \
'11,21-12,21=SAG;12,22-01,20=CAP;01,21-02,21=AQU;02,22-03,20=PIS;'
def find_astrological_sign(month, date):
'''
(int, int) -> str
Given two int values representing a month and a date, return a
3-character string that gives us what star sign a person born in that
month and on that date belongs to. Use the SIGNS string (already
defined for you at the top of this file) to figure this out.
NOTE: A lot of string slicing to do here. The
information for each sign is exactly 16 characters long.
>>> find_astrological_sign(8, 24)
'VIR'
>>> find_astrological_sign(1, 15)
'CAP'
'''
Looking for a way to complete this function by accessing the string SIGNS
In: Computer Science
how can I save a character stack to a string and then save that string into a new string arraylist in java?
so if the character stack is h, e, l, l, o
i want it to save "hello" to a string and then put that string into
an array list.
In: Computer Science
Current U.S. military doctrine recognizes four categories of power available to a nation: diplomatic, informational, military, and economic. Upon examination, it is apparent that only a nation/state can wield these elements of power; they would be beyond the reach of weaker powers or organizations. How then, can these lesser entities influence the powerful? Five “underdog” strategies are outlined as alternative sources of power for the weak. If you are trying to influence the national policy of the United States, which of these five strategies do you feel would be the most effective? Why?
In: Computer Science
Using the Web, find a case of cyber stalking that is not
mentioned in this chapter. You may find some of the following
websites helpful:
www.safetyed.org/help/stalking/
Write a brief paper discussing this case, with particular attention
to steps you think might have helped avoid or ameliorate the
situation.
In: Computer Science
Linux Question: you will practice on creating and editing a text file by VI.
How to:
$ sudo yum –y install java-1.8.0-openjdk-devel.x86_64
Here's the code
|
import java.util.Scanner; // Import the Scanner class class MollyHomework { public static void main(String[] args) { Scanner myObj = new Scanner(System.in); // Create a Scanner object System.out.println("Enter your first name"); String fName = myObj.nextLine(); // Read user input of the first name System.out.println("Enter your last name"); String lName = myObj.nextLine(); // Read user input of the last name System.out.println("Hello " + fName + “ “ + lName); // Output user input } } |
3.To compile the above java code, run the following command (you need to use your java file name):
$ javac MollyHomework.java
4. To execute the java program, run the following command
$ java MollyHomework
Question:
Describe how you created above file and its contents in VI.
Note: Brute-force solution means that entering characters one by one.
*Show how the code looks or how you got it to work in your linux machine
In: Computer Science
1.
In which VoIP phase does Skype use a server instead of service directly between peers?
|
signaling |
||
|
transport |
||
|
login |
||
|
None of these |
2.
Skype login is necessary so that the user ________.
|
can find the IP address of a Skype proxy server |
||
|
can find the IP address of a client it wishes to communicate with |
||
|
can find her own Skype address |
||
|
None of these |
3.
Why is link-by-link encryption for confidentiality not fully secure even if there is encryption for confidentiality in all links along the way?
|
There cannot be confidentiality on each link. |
||
|
Devices along the way may not be secure. |
||
|
both There cannot be confidentiality on each link and Devices along the way may not be secure |
||
|
neither There cannot be confidentiality on each link nor Devices along the way may not be secure |
4.
Which of the following is a file format standard?
|
HTML |
||
|
HTTP |
||
|
both HTML and HTTP |
||
|
neither HTML nor HTTP |
5.
When a cloud client customer moves from one client machine to another, ________.
|
the same data files are available |
||
|
the same application software personalization is in effect |
||
|
both the same data files are available and the same application software personalization is in effect |
||
|
neither the same data files are available nor the same application software personalization is in effect |
6.
In Skype, a directory search to find the IP address of a client to be called, is done by ________.
|
peers |
||
|
super nodes |
||
|
Skype servers |
||
|
direct communication between the calling and receiving clients |
7.
Skype provides ________.
|
Voice over IP |
||
|
Video over IP |
||
|
both Voice over IP and Video over IP |
||
|
neither Voice over IP nor Video over IP |
8.
Which of the following allows you to read your e-mail easily on an Internet café's computer?
|
HTTP |
||
|
HTML |
||
|
IMAP |
||
|
SMTP |
In: Computer Science
Write a C++ program that will be an information system for Oregon State University using classes as well as demonstrating a basic understanding of inheritance and polymorphism.
You will create a representation of an Oregon State University information system that will contain information about the university. The university will contain a name of the university, n number of buildings, and m number of people. People can be either a student or an instructor. Every person will have a name and an age. Every student will have also have a GPA, but an instructor will NOT have a GPA. Every instructor will have an instructor rating, but a student will NOT have an instructor rating. Every building will have a name, the size in sqft (preferred the real value which you need to look up), and an address (stored as a string, also preferred to look this up).
People will contain a method called “do_work” that will take in a random integer as a parameter that represents how many hours they will do work for. If the person is a student, a message will be printed to the screen that says “PERSON_NAME did X hours of homework.” If the person is an instructor, a message will be printed to the screen that says “Instructor PERSON_NAME graded papers for X hours.” You will need to fill in the appropriate values.
The student GPA can either be an input from the user or randomized, but it must be between 0.0 and 4.0. It cannot be preset. The instructor rating can either be an input from the user or randomized, but it must be between 0.0 and 5.0. The ages of a person can be randomized or an input, but make it realistic. You can choose whether it is randomized or user input, or both.
The university will contain a method that will print the name and address of all the buildings in its information system and another method that will print the name of all the people. The name of the university MUST be “Oregon State University” (because we are the best).
You will manually instantiate at least 1 student, 1 instructor, and 2 buildings, then give them values and store them appropriately in the university object. You can do this in whatever fashion you wish.
You will have a menu that does at least the following:
1) Prints names of all the buildings
2) Prints names of everybody at the university
3) Choose a person to do work
4) Exit the program
Note that option 3 will require you to print another menu that gives options for each person.
You may create any other functions, methods, member variables, etc. to modularize your code and complete the lab.
Extra Credit Add an option to save the information system to a file, and add an option to read a saved information system from a file so that you can close the program, but not lose information. This will also require you to be able to add people and/or buildings to the program during runtime. This is an all or nothing extra credit (you will not get partial points for partial completion).
In: Computer Science
Class GroceryBag
collects instances of class Item in an appropriate
data structure.
Class Item
---------------------------
-String description
-int cost //price in cents
----------------------------
+ [constructor, getters, and a toString() method]
• (Assume
class Item has already been coded)
Class GroceryBag (Highlights)
----------------------------------
-bag // an ArrayList of
<Item>
----------------------------------
assume public methods: constructor, totalBag(), findItem(String
it), listAll(), etc.
• The
ONLY thing you need to do in the space below is to
write java code for the complete method specified:
• In
the space below, write code for a complete method
void showCheapItems()
that will use the ArrayList
bag and which will display all
Items in the bag whose price is below the overall average
of
all the prices of all the items in the bag.
[Hint: average will be the sum divided by the number of
items].
Required: use at least one for-each loop as part of your
method.
please help quickly!!!!!
In: Computer Science