this program shows an error that
Error (active) E0308 more than one instance of overloaded function "find" matches the argument list:
can you fix that, please? debug the program output should be like that
The list is...
51, 45, 2, 13, 12, 4, 3, 5
Enter the element to be searched for
45
is present in the list.
//The program
sample.cpp
#include <iostream>
#include "node1.cpp"
using namespace main_savitch_5;
template<class iterator, class T>
iterator find(iterator start, iterator end, const T&
target);
template<class iterator, class T>
void traverseList(iterator start, iterator end);
template<class iterator, class T>
T get_data(iterator current_ptr);
int main()
{
node<int>* head = NULL;
list_head_insert(head, 5);
list_head_insert(head, 3);
list_head_insert(head, 4);
list_head_insert(head, 12);
list_head_insert(head, 13);
list_head_insert(head, 2);
list_head_insert(head, 45);
list_head_insert(head, 51);
cout << "The list is..." << endl;
traverseList<node<int>*, int > (head,
NULL);
int x;
cout << "Enter the element to be searched
for\n";
cin >> x;
node<int>* ptr = find<node<int>*,
int>(head, NULL, x);
if (ptr)
cout << x
<< "is present in the list\n";
else
cout << x
<< "is not present in the list\n";
return 0;
}
template<class iterator, class T>
iterator f(iterator start, iterator end, const T& target)
{
iterator temp = start;
while (temp != end)
{
if (get_data<iterator,
T>(temp) == target)
return
temp;
temp = get_next<iterator,
T>(temp);
}
return end;
}
template<class iterator, class T>
void traverseList(iterator start, iterator end)
{
iterator temp = start;
while (temp != end)
{
cout << get_data <
iterator, T(temp) << " ";
temp = get_next<iterator,
T>(temp);
}
cout << endl;
}
template<class iterator, class T>
T get_data(iterator current_ptr)
{
return current_ptr->data();
}
template<class iterator, class T>
iterator get_next(iterator current_ptr)
{
return current_ptr->link();
}
node1.cpp
#include "node1.h"
using namespace std;
namespace main_savitch_5
{
template<class item>
size_t list_length(const node<item>*
head_ptr)
{
const node<item>*
cursor;
size_t answer;
answer = 0;
for (cursor = head_ptr; cursor !=
NULL; cursor = cursor->link())
++answer;
return answer;
}
template<class item>
void list_head_insert(node<item>*& head_ptr,
const node<int>::value_type& entry)
{
head_ptr = new
node<item>(entry, head_ptr);
}
template<class item>
void list_insert(node<item>* previous_ptr, const
node<int>::value_type& entry)
{
node<item>* insert_ptr;
insert_ptr = new
node<item>(entry, previous_ptr());
previous_ptr->set_link(insert_ptr);
}
template<class item>
node<item>* list_search(node<item>*
head_ptr, const node<int>::value_type& target)
{
node<item>* cursor;
for (cursor = head_ptr; cursor !=
NULL; cursor = cursor->link())
return
cursor;
return NULL;
}
template<class item>
const node<item>* list_search(const
node<item>* head_ptr, const node<int>::value_type&
target)
{
const node<item>*
cursor;
for (cursor = head_ptr; cursor !=
NULL; cursor = cursor->linl())
if (target ==
cursor->data())
return cursor;
return NULL;
}
template<class item>
node<int>* list_locate(node<int>*
head_ptr, size_t position)
{
node<int>* cursor; (0 <
position);
cursor = head_ptr;
for (i = 1; (i && cursor !=
NULL);
i++)
cursor =
cursor->link();
return cursor;
}
template<class item>
const node<int>* list_locate(const
node<int>* head_ptr, size_t position)
{
const node<int>*
cursor;
size_t i;
assert(0 < position);
cursor = head_ptr;
for (i = 1; (i < position)
&& (cursor != NULL); i++)
cursor =
cursor->link();
return cursor;
}
template<class item>
void list_head_remove(node<int>* head_ptr)
{
node<int>* remove_ptr;
remove_ptr = head_ptr;
head_ptr =
head_ptr->link();
delete remove_ptr;
}
template<class item>
void list_remove(node<int>* previous_ptr)
{
node<int>* remove_ptr;
remove_ptr =
previous_ptr->link());
delete remove_ptr;
}
template<class item>
void list_clear(node<int>*& head_ptr)
{
while (head_ptr != NULL)
list_head_remove(head_ptr);
}
template<class item>
void list_copy(const node<int>* source_ptr,
node<int>*& head_ptr, node<int>** tail_ptr)
{
head_ptr = NULL;
tail_ptr = NULL;
if (source_ptr == NULL)
return;
list_head_insert(head_ptr,
source_ptr->data());
tail_ptr = head_ptr;
source_ptr =
source_ptr->link();
while (source_ptr != NULL)
{
list_insert(tail_ptr, source_ptr->data());
tail_ptr =
tail_ptr->link();
source_ptr =
source_ptr->link();
}
}
}
node1.h
#ifndef MAIN_SAVITCH_NODE1_H
#define MAIN_SAVITCH_NODE1_H
#include <string>
namespace main_savitch_5
{
template<class item>
class node
{
public:
typedef item value_type;
node(const value_type&
init_data = value_type(), node* init_link = NULL)
{
data_field =
init_data;
link_field =
new_data;
}
void set_data(const value_type&
new_data)
{
data_field =
new_data;
}
void set_link(node<item>*
new_link)
{
link_field =
new_link;
}
value_type data()const
{
return
data_field;
}
const node<item>*
link()const
{
return
link_field;
}
node<item>* link()
{
return
link_field;
}
private:
value_type data_field;
node<item>* link_field;
};
template<class item>
std::size_t list_length(const node<item>*
head_ptr);
template<class item>
void list_head_insert(node<item>*& head_ptr,
const node<int>::value_type& entry);
template<class item>
void list_insert(node<item>* previous_ptr, const
node<int>::value_type& entry);
template<class item>
node<item>* list_search(node<item>*
head_ptr, const node<int>::value_type& target);
template<class item>
const node<item>* list_search(const
node<item>* head_ptr, const node<int>::value_type&
target);
template<class item>
node<item>* list_locate(node<item>*
head_ptr, std::size_t position);
template<class item>
const node<item>* list_locate(const
node<item>* head_ptr, std::size_t position);
template<class item>
void list_head_remove(node<item>*&
head_ptr);
template<class item>
void list_remove(node<item>* previous_ptr);
template<class item>
void list_copy(const node<item>* source_ptr,
node<item>*& tail_ptr);
}
#endif
In: Computer Science
Professional Development Event Review
Carrier- information Technology (IT)
Part of developing as a professional in any career path is attending events that can further your knowledge of a field. This can be in the form of seminars, webinars, conferences, workshops, and sometimes online training if you are learning a new technical skill. The completion of this assignment requires two parts, which should take up 3-4 pages.
Part 1: Attend 3 (or more) events related to the computing profession and reflect on them. These could be workshops, seminars, training, information sessions, conferences, panels, etc. The Career Fair does not count as a professional development event. Describe what you learned in the event and how it can help you in the future of your career. Also, critique the event and explain how it could have been made better and/or what you particularly liked about it. If you are already working with a company that offers professional development, that will be a great resource to pull from!
Part 2: Imagine that you are an employer in charge of creating a seminar to train or help develop new professionals in your company. Explain your seminar. Some questions to consider answering: What would it be about? Who would it be for? How would you go about presenting it? What do you hope your new employees will gain from the seminar? How will you know they got something from the event?
In: Operations Management
Subject: Operating System Design
Homework:
1. List and briefly define the four main elements of a computer.
2. Define the two main categories of processor registers.
3. In general terms, what are the four distinct actions that a machine instruction can specify?
4. What characteristics distinguish the various elements of a memory hierarchy?
5. What is the difference between a multiprocessor and a multi-core system?
6. What is the distinction between spatial locality and temporal locality? In general, what are the strategies for exploiting spatial locality and temporal locality?
In: Computer Science
In: Operations Management
In: Psychology
According to Frederick Brooks (The Mythical Man-Month), how should the distribution of effort for each of the primary phases (as fractions of the total) be scheduled in a software development project? How does this differ from conventional scheduling?
In: Operations Management
In: Computer Science
It's true — sand dunes in Colorado rival sand dunes of the Great Sahara Desert! The highest dunes at Great Sand Dunes National Monument can exceed the highest dunes in the Great Sahara, extending over 700 feet in height. However, like all sand dunes, they tend to move around in the wind. This can cause a bit of trouble for temporary structures located near the "escaping" dunes. Roads, parking lots, campgrounds, small buildings, trees, and other vegetation are destroyed when a sand dune moves in and takes over. Such dunes are called "escape dunes" in the sense that they move out of the main body of sand dunes and, by the force of nature (prevailing winds), take over whatever space they choose to occupy. In most cases, dune movement does not occur quickly. An escape dune can take years to relocate itself. Just how fast does an escape dune move? Let x be a random variable representing movement (in feet per year) of such sand dunes (measured from the crest of the dune). Let us assume that x has a normal distribution with μ = 10 feet per year and σ = 3.7 feet per year.
Under the influence of prevailing wind patterns, what is the probability of each of the following? (Round your answers to four decimal places.)
(a) an escape dune will move a total distance of more than 90 feet in 9 years
(b) an escape dune will move a total distance of less than 80 feet in 9 years
(c) an escape dune will move a total distance of between 80 and 90 feet in 9 years
In: Math
use VISUAL STUDIO CODE to write this javascript program
Exercise 1
(a) Create a HTML file that uses createElement and appendChild to dynamically insert three paragraphs when a button is clicked.
(b) Create a HTML file that includes JavaScript that is similar to: let recs = [“my item …1”,”my item…2”, …] i.e. an array that contains several CSV item records. When the user clicks a button, each array element will be rendered as a list element. Use a HTML list. Use createElement and appendChild.
(c) Redo your createTable code from last week’s lab so that it uses createElement and appendChild rather than setting an innerHTML property.
In: Computer Science
Principles of Addiction: Comprehensive Addictive Behaviors and Disorders, Volume 1. Supplementary text for this course. Identify two topics of interest to you, read the correlating chapters, and share your overall thoughts. At what point do you consider one of your chosen topics to be an addiction? What criteria would an individual need to meet to classify one of these topics as an addiction? Do you or someone you know experience one of your chosen topics as an addiction? How has this affected your/their life?
In: Psychology
The advent of Information and Communication Technology has had a huge impact whether one is doing research, communicating or buying a product online. Write an essay about how ICT has positively impacted the education, commerce and Healthcare.
In: Computer Science
Write a program in C that allows you to determine the endianness of your computer. Hint: use unsigned char* ptr.
Your task is to explain this code. Make sure that you are detailed in your explanation by explaining the significant lines. In particular, correct explanation of lines 12, 13, 15, 18, 21, 22, 24, 25, 26 and 27 will earn 1 point each. Additionally, explain the overall purpose of the logical operations in lines 24-27 for 2 points. Your explanation should not just reiterate the code. For example, don’t simply say that the for loop iterates 4 times, but rather, explain why and what doing so accomplishes. It would be beneficial to run the code and examine memory contents in gdb.
Here’s an example explanation for line #20: Line #20 prints out the hexadecimal value of x to the console. The %#010x format specifier specifies that the value is printed in hexadecimal (the ‘x’ flag). The # indicates to prepend “0x” to the number. The ‘0’ flag following it indicates that the number should be padded by 0s at the left. The number following it, in this case ‘10’ is the total width of the number we want to display, including the ‘0x’. For example, if the value of x is 1C, then 6 0s are padded to fill up the 10-character space.
1/*
2 * endian.c
3 * Determines endianess. If endianess cannot be determined
4 * from input value, defaults to "big endian"
5 * Bob Plantz - 22 June 2009
6 */
7
8#include
9
10 int main(void)
11{
12 unsigned char *ptr;
13 int x, i, bigEndian;
14
15 ptr = (unsigned char *)&x;
16
17 printf("Enter a non-zero integer: ");
18 scanf("%i", &x);
19
20 printf("You entered %#010x and it is stored\n", x);
21 for (i = 0; i < 4; i++)
22 printf(" %p: %02x\n", ptr + i, *(ptr + i));
23
24 bigEndian = (*ptr == (unsigned char)(0xff & (x >> 24))) &&
25 (*(ptr + 1) == (unsigned char)(0xff & (x >> 16))) &&
26 (*(ptr + 2) == (unsigned char)(0xff & (x >> 8))) &&
27 (*(ptr + 3) == (unsigned char)(0xff & x));
28 if (bigEndian)
29 printf("which is big endian.\n");
30 else
31 printf("which is little endian.\n");
32
33 return 0;
34}
In: Computer Science
A self-employed worker operates a firewood-splitting service. He purchased a commercial-grade wood splitter for $5800. He used $400 of business capital and financed the balance at 5% per year for 3 years. The estimated values of the splitter for the next 6 years are $2200 after the first year of ownership, decreasing by $400 per year to year 5, after which the resale value remains at $600. Annual operating costs are expected to be $1000 the first year, increasing by 10% each year thereafter. He considers keeping the splitter at least 6 years. If money is worth 7% per year, for how many years should the splitter be retained? (Perform the Economic Minimum Life analysis for at least 12 years.) Spreadsheet solution required with a summary of what is being analyzed.
In: Finance
You want to evaluate three mutual funds using the Jensen measure for performance evaluation. The risk-free return during the sample period is 6%, and the average return on the market portfolio is 18%. The average returns, standard deviations, and betas for the three funds are given below.
Average Return | Residual Standard Deviation | Beta | ||||||||||
Fund A | 17.6 | % | 10 | % | 1.2 | |||||||
Fund B | 17.5 | % | 20 | % | 1.0 | |||||||
Fund C | 17.4 | % | 30 | % | 0.8 | |||||||
The fund with the highest Jensen measure is
Multiple Choice
Fund A.
Fund B.
Fund C.
Funds A and B (tied for highest).
Funds A and C (tied for highest).
In: Finance
Write a code on Jupytor notebook:
Pocket 0 is green. For pockets 1 through 10, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 11 through 18, the odd-numbered pockets are black and the even-numbered pockets are red. For pockets 19 through 28, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 29 through 36, the odd-numbered pockets are black and the even-numbered pockets are red. Write a program that asks the user to enter a pocket number and displays whether the pocket is green, red, or black. The program should display an error message if the user enters a number that is outside the range of 0 through 36. |
|
3. Check the Baruch/CUNY Pathways requirements for college option – http://www.baruch.cuny.edu/genedreqs/pathwaysatbaruch/pathwaysoptions_baruch.htm. Ask the user the right questions and do the right checks to display the coursework that the user needs to complete. |
4. Calculate BMI for user provided weight and height and display an interpretation of the BMI. |
In: Computer Science