This document contains code for an assignment on implementing dictionaries and hashing. It includes:
1. Code for an Employee class and KeyValuePair class to be used for testing.
2. An incomplete HashDictionary class that needs probe(), hash(), insert(), and find() methods implemented using quadratic probing and mid-square hashing.
3. Main() function with commented out tests to validate the implemented methods.
Modify this code to use multiple threads with the same data1.Modif.pdfmallik3000
Modify this code to use multiple threads with the same data
1.Modify the main function to implement a loop that reads 10 integers from the console (user
input) and stores these numbers in a one-dimensional (1D) array (this code will go right after the
comment that says “Add code to perform any needed initialization or to process user input”).
You should use a global array for this.
2.Implement a separatepthread function function for each one of the following operations:
a.Count and print out how many of the entered numbers are negative. This function must be
named countNegatives
b.Calculate and print the average value of all the numbers entered. This function must be named
average
c.Print the numbers in reverse order from the order in which they were entered. This function
must be named reverse
3.Modify the main function to create one pthread for each one of the functions that you
implemented in (3) above (this code will go between the comment that says “TODO: Modify
according to assignment requirements” and the “if (rc)” check).
Compile your program and run it several times. If the output of your program is garbled, you
may need to add a small delay in between creating the next thread.
#include
#include
using namespace std;
void *routineName(void *arg)
{
// TODO: Add code that implements
// the thread\'s functionality
cout << \"Thread is running...\" << endl;
return 0;
}
int main()
{
pthread_t id;
int rc;
int ints;
for(int x; x<10; x++)
{
cout << \"Enter Integer: \" <>
}
rc = pthread_create(&id, NULL, routineName, NULL);
if (rc){
cout << \"ERROR; return code from pthread_create() is \" << rc << endl;
return -1;
}
pthread_exit(0);
}
Solution
#include
#include
#include
using namespace std;
int ints[10];
//Method to count negatives in the input array
void *countNegatives(void*){
int count = 0;
for(int i=0;i<10;i++){
if(ints[i]<0){
count++;
}
}
cout<<\"Number of negatives: \"<=0;i--){
cout<> ints[x];
}
//Creating pthread to countNegatives
rc = pthread_create(&t1, NULL, countNegatives, NULL);
if(rc){
cout << \"Error:unable to create thread,\" << rc << endl;
}
//Adding delay
sleep(1);
//Creating pthread to compute average
rc = pthread_create(&t2, NULL, average, NULL);
if(rc){
cout << \"Error:unable to create thread,\" << rc << endl;
}
//Adding delay
sleep(1);
//Creating pthread to print in reverse
rc = pthread_create(&t3, NULL, reverse, NULL);
if(rc){
cout << \"Error:unable to create thread,\" << rc << endl;
}
//Adding delay
sleep(1);
void* status;
//waiting for t1 to join
rc = pthread_join(t1,&status);
if(rc){
cout << \"Error:unable to join,\" << rc << endl;
}
//waiting for t2 to join
rc = pthread_join(t2,&status);
if(rc){
cout << \"Error:unable to join,\" << rc << endl;
}
//waiting for t3 to join
rc = pthread_join(t3,&status);
if(rc){
cout << \"Error:unable to join,\" << rc << endl;
}
pthread_exit(0);
}.
Sheet1Amys One Day Food RecallHeight 5 ft 8 inchesAge 19Weight.docxedgar6wallace88877
Sheet1Amy's One Day Food RecallHeight: 5 ft 8 inchesAge: 19Weight: 134 lbsGender: FemaleFood DescriptionQuantitycarbohydrate (g)protein (g)Fat (g)Saturated fat (g)Cholesterol (mg)Fiber (g)Sodium (mg)potassium (mg)CaloriesToasted multigrain bread1 slice12410021086573Creamy peanut butter with added salt2 Tbsp7716302136179200BananaOne100031435104Garlic hummus3 Tbsp748103192140116Baby carrots7 sticks9100038224940Salted pretzels15 twists482002744134234Cooked white Jasmine rice (no oil)1 cup4640001255200Seared filet of salmon3 oz0236248045387Raw shredded romaine lettuce1 cup20000141168Feta cheese crumbled1 oz14425017089374Raw cherry tomatoes whole6 small tomatoes410001524220Vinaigrette2 Tbsps4061002922570Raw cucumber sliced with peel½ cup2000001768Lindt dark chocolate 70% cocoa2 squares1116421300Black coffee1 cup01000021244Granulated sugar1 Tsp4000000016Whole milk1 cup1285240105322152
Source/Assg13/assg-13.cppSource/Assg13/assg-13.cpp/**
*
*
* @description Assignment 13 Dictionaries and Hash table
* implementations.
*/
#include<cassert>
#include<iostream>
#include"KeyValuePair.hpp"
#include"Employee.hpp"
#include"HashDictionary.hpp"
usingnamespace std;
/** main
* The main entry point for this program. Execution of this program
* will begin with this main function.
*
* @param argc The command line argument count which is the number of
* command line arguments provided by user when they started
* the program.
* @param argv The command line arguments, an array of character
* arrays.
*
* @returns An int value indicating program exit status. Usually 0
* is returned to indicate normal exit and a non-zero value
* is returned to indicate an error condition.
*/
int main(int argc,char** argv)
{
// -----------------------------------------------------------------------
cout <<"----- testing Employee record and KeyValuePair class -----------"<< endl;
KeyValuePair<int, string> pair(42,"blue");
cout <<"test key: "<< pair.key()<< endl;
assert(pair.key()==42);
cout <<"test value: "<< pair.value()<< endl;
assert(pair.value()=="blue");
int id =3;
Employee e(id,"Derek Harter","1234 Main Street, Commerce TX",12345.67);
cout << e << endl;
assert(e.getId()==3);
assert(e.getName()=="Derek Harter");
cout << endl;
// -----------------------------------------------------------------------
cout <<"-------------- testing quadratic probing -----------------------"<< endl;
constint TABLE_SIZE =7;
HashDictionary<int,Employee> dict(TABLE_SIZE, EMPTY_EMPLOYEE_ID);
cout <<"Newly created hash dictionary should be empty, size: "<< dict.size()<< endl;
assert(dict.size()==0);
int probeIndex =0;
//cout << "probe index: " << probeIndex
// << " returned probe value: " << dict.probe(id, probeIndex)
// << endl;
//assert(dict.probe(id, probeIndex) == 2);
probeIndex =1;
//cout << "probe index: " << probeIndex
// << " returned probe value: " << dict.probe(id, probeIndex)
// << endl;
//assert(di.
Basic Introduction to programming functions, Contents include.
- Definition of function
- Structure of function
- Function calling
- Function Prototyping
- Scope of the function
- Input parameters to a function
- Returning from the function
- Types of function calling
I am Baddie K. I am a C++ Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from The University of Queensland. I have been helping students with their homework for the past 9 years. I solve homework related to C++. Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with C++ Homework.
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdfrahulfancycorner21
C++ code, please help! RESPOND W/ COMPLETED CODE PLEASE, am using Visual Studio
Code.
Error message:
ld: Undefined symbols:
parseName(std::__1::basic_stringstream, std::__1::allocator>&), referenced from:
parseAssignments(std::__1::basic_stringstream, std::__1::allocator>&) in module-a187a7.o
SymbolTable::init(), referenced from:
_main in module-a187a7.o
parseAssignments(std::__1::basic_stringstream, std::__1::allocator>&) in module-a187a7.o
SymbolTable::insert(std::__1::basic_string, std::__1::allocator>, int), referenced from:
parseAssignments(std::__1::basic_stringstream, std::__1::allocator>&) in module-a187a7.o
SubExpression::parse(std::__1::basic_stringstream, std::__1::allocator>&), referenced from:
_main in module-a187a7.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Done] exited with code=1 in 1.478 seconds
divide.h
class Divide : public SubExpression
{
public:
//define the default construtor
Divide(Expression* left, Expression* right) : SubExpression(left, right)
{
}
//define the function evaluate()
int evaluate()
{
//divide the value of left and value of the right
//and return the value.
return left->evaluate() / right->evaluate();
}
};
expression.h
// Expression
class Expression
{
public:
//declare a virtual function evaluate()
virtual int evaluate() = 0;
};
literal.h
//Operand
class Literal : public Operand
{
public:
//define the construtor
Literal(int value)
{
this->value = value;
}
//define the function evaluate()
//returns the value
int evaluate()
{
return value;
}
private:
int value;
};
minus.h
//define the class Minus subclass of the SubExpression
class Minus : public SubExpression
{
public:
//define the default construtor
Minus(Expression* left, Expression* right) : SubExpression(left, right)
{
}
//define the function evaluate()
int evaluate()
{
//subtract the value of right from the value of the left
//and return the value.
return left->evaluate() - right->evaluate();
}
};
module.cpp
#include
#include
#include
#include
#include
using namespace std;
#include "expression.h"
#include "subexpression.h"
#include "symboltable.h"
#include "parse.h"
//create an object of SymbolTable
SymbolTable symbolTable;
//prototype of the function
void parseAssignments(stringstream& in);
//define main function
int main()
{
// declare the variables
Expression* expression;
char paren, comma;
string line;
// create an input file stream
ifstream fin("input.txt");
// check, if the file is not opened
//then display a error message
if (!fin.is_open())
perror("error while opening file");
//use a loop, to read the content from the file
while (getline(fin, line))
{
symbolTable.init();
if (!fin)
break;
stringstream in(line, ios_base::in);
in >> paren;
cout << line << " ";
expression = SubExpression::parse(in);
in >> comma;
//call the function
parseAssignments(in);
//Display the result
int result = expression->evaluate();
cout << "Value = " << result << endl;
}
system("pause");
return 0;
}
//definition of the function p.
Modify this code to use multiple threads with the same data1.Modif.pdfmallik3000
Modify this code to use multiple threads with the same data
1.Modify the main function to implement a loop that reads 10 integers from the console (user
input) and stores these numbers in a one-dimensional (1D) array (this code will go right after the
comment that says “Add code to perform any needed initialization or to process user input”).
You should use a global array for this.
2.Implement a separatepthread function function for each one of the following operations:
a.Count and print out how many of the entered numbers are negative. This function must be
named countNegatives
b.Calculate and print the average value of all the numbers entered. This function must be named
average
c.Print the numbers in reverse order from the order in which they were entered. This function
must be named reverse
3.Modify the main function to create one pthread for each one of the functions that you
implemented in (3) above (this code will go between the comment that says “TODO: Modify
according to assignment requirements” and the “if (rc)” check).
Compile your program and run it several times. If the output of your program is garbled, you
may need to add a small delay in between creating the next thread.
#include
#include
using namespace std;
void *routineName(void *arg)
{
// TODO: Add code that implements
// the thread\'s functionality
cout << \"Thread is running...\" << endl;
return 0;
}
int main()
{
pthread_t id;
int rc;
int ints;
for(int x; x<10; x++)
{
cout << \"Enter Integer: \" <>
}
rc = pthread_create(&id, NULL, routineName, NULL);
if (rc){
cout << \"ERROR; return code from pthread_create() is \" << rc << endl;
return -1;
}
pthread_exit(0);
}
Solution
#include
#include
#include
using namespace std;
int ints[10];
//Method to count negatives in the input array
void *countNegatives(void*){
int count = 0;
for(int i=0;i<10;i++){
if(ints[i]<0){
count++;
}
}
cout<<\"Number of negatives: \"<=0;i--){
cout<> ints[x];
}
//Creating pthread to countNegatives
rc = pthread_create(&t1, NULL, countNegatives, NULL);
if(rc){
cout << \"Error:unable to create thread,\" << rc << endl;
}
//Adding delay
sleep(1);
//Creating pthread to compute average
rc = pthread_create(&t2, NULL, average, NULL);
if(rc){
cout << \"Error:unable to create thread,\" << rc << endl;
}
//Adding delay
sleep(1);
//Creating pthread to print in reverse
rc = pthread_create(&t3, NULL, reverse, NULL);
if(rc){
cout << \"Error:unable to create thread,\" << rc << endl;
}
//Adding delay
sleep(1);
void* status;
//waiting for t1 to join
rc = pthread_join(t1,&status);
if(rc){
cout << \"Error:unable to join,\" << rc << endl;
}
//waiting for t2 to join
rc = pthread_join(t2,&status);
if(rc){
cout << \"Error:unable to join,\" << rc << endl;
}
//waiting for t3 to join
rc = pthread_join(t3,&status);
if(rc){
cout << \"Error:unable to join,\" << rc << endl;
}
pthread_exit(0);
}.
Sheet1Amys One Day Food RecallHeight 5 ft 8 inchesAge 19Weight.docxedgar6wallace88877
Sheet1Amy's One Day Food RecallHeight: 5 ft 8 inchesAge: 19Weight: 134 lbsGender: FemaleFood DescriptionQuantitycarbohydrate (g)protein (g)Fat (g)Saturated fat (g)Cholesterol (mg)Fiber (g)Sodium (mg)potassium (mg)CaloriesToasted multigrain bread1 slice12410021086573Creamy peanut butter with added salt2 Tbsp7716302136179200BananaOne100031435104Garlic hummus3 Tbsp748103192140116Baby carrots7 sticks9100038224940Salted pretzels15 twists482002744134234Cooked white Jasmine rice (no oil)1 cup4640001255200Seared filet of salmon3 oz0236248045387Raw shredded romaine lettuce1 cup20000141168Feta cheese crumbled1 oz14425017089374Raw cherry tomatoes whole6 small tomatoes410001524220Vinaigrette2 Tbsps4061002922570Raw cucumber sliced with peel½ cup2000001768Lindt dark chocolate 70% cocoa2 squares1116421300Black coffee1 cup01000021244Granulated sugar1 Tsp4000000016Whole milk1 cup1285240105322152
Source/Assg13/assg-13.cppSource/Assg13/assg-13.cpp/**
*
*
* @description Assignment 13 Dictionaries and Hash table
* implementations.
*/
#include<cassert>
#include<iostream>
#include"KeyValuePair.hpp"
#include"Employee.hpp"
#include"HashDictionary.hpp"
usingnamespace std;
/** main
* The main entry point for this program. Execution of this program
* will begin with this main function.
*
* @param argc The command line argument count which is the number of
* command line arguments provided by user when they started
* the program.
* @param argv The command line arguments, an array of character
* arrays.
*
* @returns An int value indicating program exit status. Usually 0
* is returned to indicate normal exit and a non-zero value
* is returned to indicate an error condition.
*/
int main(int argc,char** argv)
{
// -----------------------------------------------------------------------
cout <<"----- testing Employee record and KeyValuePair class -----------"<< endl;
KeyValuePair<int, string> pair(42,"blue");
cout <<"test key: "<< pair.key()<< endl;
assert(pair.key()==42);
cout <<"test value: "<< pair.value()<< endl;
assert(pair.value()=="blue");
int id =3;
Employee e(id,"Derek Harter","1234 Main Street, Commerce TX",12345.67);
cout << e << endl;
assert(e.getId()==3);
assert(e.getName()=="Derek Harter");
cout << endl;
// -----------------------------------------------------------------------
cout <<"-------------- testing quadratic probing -----------------------"<< endl;
constint TABLE_SIZE =7;
HashDictionary<int,Employee> dict(TABLE_SIZE, EMPTY_EMPLOYEE_ID);
cout <<"Newly created hash dictionary should be empty, size: "<< dict.size()<< endl;
assert(dict.size()==0);
int probeIndex =0;
//cout << "probe index: " << probeIndex
// << " returned probe value: " << dict.probe(id, probeIndex)
// << endl;
//assert(dict.probe(id, probeIndex) == 2);
probeIndex =1;
//cout << "probe index: " << probeIndex
// << " returned probe value: " << dict.probe(id, probeIndex)
// << endl;
//assert(di.
Basic Introduction to programming functions, Contents include.
- Definition of function
- Structure of function
- Function calling
- Function Prototyping
- Scope of the function
- Input parameters to a function
- Returning from the function
- Types of function calling
I am Baddie K. I am a C++ Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from The University of Queensland. I have been helping students with their homework for the past 9 years. I solve homework related to C++. Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with C++ Homework.
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdfrahulfancycorner21
C++ code, please help! RESPOND W/ COMPLETED CODE PLEASE, am using Visual Studio
Code.
Error message:
ld: Undefined symbols:
parseName(std::__1::basic_stringstream, std::__1::allocator>&), referenced from:
parseAssignments(std::__1::basic_stringstream, std::__1::allocator>&) in module-a187a7.o
SymbolTable::init(), referenced from:
_main in module-a187a7.o
parseAssignments(std::__1::basic_stringstream, std::__1::allocator>&) in module-a187a7.o
SymbolTable::insert(std::__1::basic_string, std::__1::allocator>, int), referenced from:
parseAssignments(std::__1::basic_stringstream, std::__1::allocator>&) in module-a187a7.o
SubExpression::parse(std::__1::basic_stringstream, std::__1::allocator>&), referenced from:
_main in module-a187a7.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Done] exited with code=1 in 1.478 seconds
divide.h
class Divide : public SubExpression
{
public:
//define the default construtor
Divide(Expression* left, Expression* right) : SubExpression(left, right)
{
}
//define the function evaluate()
int evaluate()
{
//divide the value of left and value of the right
//and return the value.
return left->evaluate() / right->evaluate();
}
};
expression.h
// Expression
class Expression
{
public:
//declare a virtual function evaluate()
virtual int evaluate() = 0;
};
literal.h
//Operand
class Literal : public Operand
{
public:
//define the construtor
Literal(int value)
{
this->value = value;
}
//define the function evaluate()
//returns the value
int evaluate()
{
return value;
}
private:
int value;
};
minus.h
//define the class Minus subclass of the SubExpression
class Minus : public SubExpression
{
public:
//define the default construtor
Minus(Expression* left, Expression* right) : SubExpression(left, right)
{
}
//define the function evaluate()
int evaluate()
{
//subtract the value of right from the value of the left
//and return the value.
return left->evaluate() - right->evaluate();
}
};
module.cpp
#include
#include
#include
#include
#include
using namespace std;
#include "expression.h"
#include "subexpression.h"
#include "symboltable.h"
#include "parse.h"
//create an object of SymbolTable
SymbolTable symbolTable;
//prototype of the function
void parseAssignments(stringstream& in);
//define main function
int main()
{
// declare the variables
Expression* expression;
char paren, comma;
string line;
// create an input file stream
ifstream fin("input.txt");
// check, if the file is not opened
//then display a error message
if (!fin.is_open())
perror("error while opening file");
//use a loop, to read the content from the file
while (getline(fin, line))
{
symbolTable.init();
if (!fin)
break;
stringstream in(line, ios_base::in);
in >> paren;
cout << line << " ";
expression = SubExpression::parse(in);
in >> comma;
//call the function
parseAssignments(in);
//Display the result
int result = expression->evaluate();
cout << "Value = " << result << endl;
}
system("pause");
return 0;
}
//definition of the function p.
Instruction1. Please read the two articles. (Kincheloe part 1 &.docxcarliotwaycave
Instruction:
1. Please read the two articles. (Kincheloe part 1 & 2)
2. Please choose some of the topics covered in each chapter, provide a brief summary (2-3 sentences) of those topics.
3. Then add your reflections, insights, or relevant experiences, etc. to help illustrate or expand upon the course.
4. This journal should be at least 400 words.
p5-start.cppp5-start.cpp/**
* @author Jane Student
* @cwid 123 45 678
* @class CSci 430, Spring 2018
* @ide Visual Studio Express 2010
* @date November 15, 2018
* @assg prog-04
*
* @description This program implements a simulation of process
* scheduling policies. In this program, we implement round-robin
* scheduling, where the time slice quantum can be specified as
* as a command line parameter. And we also implement shortest
* remaining time (SRT) scheduling policy
*/
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
#include<list>
usingnamespace std;
// global constants
// I won't test your round robin implementation with more than 20 processes
constint MAX_PROCESSES =20;
constint NO_PROCESS =0;
// Simple structure, holds all of the information about processes, their names
// arrival and service times, that we are to simulate.
typedefstruct
{
string processName;
int arrivalTime;
int serviceTime;
// holds running count of time slices for current time quantum, when
// serviceTime == quantum, time slice is up
int sliceTime;
// holds total number of time steps currently run, when == to
// serviceTime process is done
int totalTime;
// holds time when process finishes, used to calculate final stats,
// like T_r, T_r/T_s
int finishTime;
// a boolean flag, we will set this to true when the process is complete
bool finished;
}Process;
// Process table, holds table of information about processes we are simulating
typedefstruct
{
int numProcesses;
Process* process[MAX_PROCESSES];
}ProcessTable;
/** Create process table
* Allocate memory for a new process table. Load the process
* information from the simulation file into a table with the process
* information needed to perform the simulation. At the same time we
* initialize other information in process table for use in the
* simulation. Return the newly created ProcessTable
*
* @param processFilanem The name (char*) of the file to open and read
* the process information from.
* @param processTable This is actually a return parameter. This
* should be a pointer to an already allocated array of
* Process structure items. We will fill in this structure
* and return the process information.
*
* @returns ProcessTable* The newly allocated and initialized ProcessTable
* structure.
*/
ProcessTable* createProcessTable(char* processFilename)
{
ifstream simprocessfile(processFilename);
ProcessTable* processTable;
int pid;
string processName;
int arrivalTime;
int serviceTime;
// If we can't open file, abort and let ...
I am Allen K. I am a Computer Science Assignment Help Expert at programminghomeworkhelp.com. I hold a Ph.D. in Programming, The University of Chicago, USA. I have been helping students with their homework for the past 9 years. I solve assignments related to Computer Science.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.
You can also call on +1 678 648 4277 for any assistance with Computer Science assignments.
I am Jason B. I am a C++ Programming Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from Princeton University, USA. I have been helping students with their homework for the past 5 years. I solve homework related to C++ Programming.
Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with C++ Programming Homework.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
#ifndef RATIONAL_H if this compiler macro is not defined #def.pdfexxonzone
#ifndef RATIONAL_H // if this compiler macro is not defined
#define RATIONAL_H // then define it so this file will not be processed again
#include \"stdafx.h\" // use only for Microsoft Visual Studio C++
#include
using namespace std;
class Rational
{
// Friend functions are actually declared outside the scope of the
// class but have the right to access public and private data and
// member function members that belong to the class. The friend
// function below gives the << operator for ostreams (including cout)
// the ability to output a Rational object by accessing its member data.
friend ostream &operator<< (ostream &out, Rational const &r);
public:
Rational(int num = 0, int denom = 1); // also provides default constructor
Rational add(Rational right);
Rational operator+ (Rational right); // + addition operator
Rational operator+= (Rational right); // += addition assignment operator
Rational operator- (Rational right); // + addition operator
Rational operator-= (Rational right); // += addition assignment operator
void display();
operator double() const; // convert Rational to double
private:
int numerator;
int denominator;
// helper functions are private and not accessible by the main program
int LCD(int v1, int v2);
Rational setRational(int n, int d);
};
#endif
#include \"stdafx.h\"
#include
#include \"Rational.h\"
using namespace std;
// By using the default parameter settings in Rational.h, this
// constructor also provides the default constructor Rational()
Rational::Rational(int num, int denom)
{
setRational(num, denom); // set numerator and denominator, reduce fraction, fix the sign
}
// Helper function to fix a zero denominator and fix the sign if denominator is negative
Rational Rational::setRational(int n, int d) // helper function
{
numerator = n;
denominator = d;
// if denominator == 0 then set it = 1
if (denominator == 0)
denominator = 1;
if (denominator < 0) // if denominator is neg, multiply num and denom by -1
{
numerator = -numerator; // fix sign of numerator +/-
denominator = -denominator; // denominator always +
}
int lcd = LCD(numerator, denominator);
if (denominator != 0)
{
numerator /= lcd;
denominator /= lcd;
}
return *this; // return the current object
}
// find the lowest common divisor using a recursive function
int Rational::LCD(int v1, int v2)
{
if (v2 == 0) return v1;
else return LCD(v2, v1%v2);
}
Rational Rational::add(Rational right)
{
int newNumerator;
int newDenominator;
newNumerator = numerator*right.denominator + right.numerator*denominator;
newDenominator = denominator * right.denominator;
// create a new Rational object and return it
return setRational(newNumerator, newDenominator);
}
// the operator+ method does the same thing as the add method
Rational Rational::operator+ (Rational right)
{
int newNumerator;
int newDenominator;
newNumerator = numerator*right.denominator + right.numerator*denominator;
newDenominator = denominator * right.denominator;
// create a new Rational object and return it
return .
C++ very good for us jvkbivucyyfuvivucyxtcubobicyxyvinoucyvibivuvuvuviviibivufucuvubibibuvibibbbibibibhibobkvucycuvibibibibobobobobobobobobobibobkgxyvibibihobibibibibibibibibibibibibibibibivibivuvuvuvuvuvbobobohobkbkbobkkbcccvgvgvgctctctctcrctcrcrcrcrcrvtvtvtctcrcrcrcrcrcrcrcrcrcrcrcrcrcrctvfvfcfvfvtcrcrct rvtctvtvtcrcrcrcrcrcrcrcrcrcrcrcrctctcrcrcrcrcrcrcrcrcrcrcrcrvrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrctvtvtvtvtvtvtctvbvvgghhhbbbbbhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhuhhuuuhuuuuuuhuuuuuuuuuuuujtvtvfvtvtvtvtvfvtctvtcctcfctcrcfcfcf f f cccccccccfccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1.Does BPH predispose this patient to cancer2. Why are pati.docxbraycarissa250
1.Does BPH predispose this patient to cancer?
2. Why are patients with BPH at increased risk for urinary tract infections?
3. What would you expect the patient’s PSA level to be after surgery?
4. What is the recommended screening guidelines and treatment for BPH?
5. What are some alternative treatments / natural homeopathic options for treatment?
.
1.Do you think that mass media mostly reflects musical taste, or.docxbraycarissa250
1.
Do you think that mass media mostly reflects musical taste, or does it play a major role in shaping musical taste? Do you feel that today’s music industry enhances or interferes with the relationship between the artist and their audience?
2.
Think of a song or piece of music that has been a part of your life for a long time and expresses your musical identity. Has the significance or “meaning” of that song changed over the years? If so, what has changed in your perception of the song, and what factors in your life - personal, cultural, or other – might have contributed?
The book is music of th peoples of the world
.
More Related Content
Similar to Assignment 13assg-13.cppAssignment 13assg-13.cpp @auth.docx
Instruction1. Please read the two articles. (Kincheloe part 1 &.docxcarliotwaycave
Instruction:
1. Please read the two articles. (Kincheloe part 1 & 2)
2. Please choose some of the topics covered in each chapter, provide a brief summary (2-3 sentences) of those topics.
3. Then add your reflections, insights, or relevant experiences, etc. to help illustrate or expand upon the course.
4. This journal should be at least 400 words.
p5-start.cppp5-start.cpp/**
* @author Jane Student
* @cwid 123 45 678
* @class CSci 430, Spring 2018
* @ide Visual Studio Express 2010
* @date November 15, 2018
* @assg prog-04
*
* @description This program implements a simulation of process
* scheduling policies. In this program, we implement round-robin
* scheduling, where the time slice quantum can be specified as
* as a command line parameter. And we also implement shortest
* remaining time (SRT) scheduling policy
*/
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
#include<list>
usingnamespace std;
// global constants
// I won't test your round robin implementation with more than 20 processes
constint MAX_PROCESSES =20;
constint NO_PROCESS =0;
// Simple structure, holds all of the information about processes, their names
// arrival and service times, that we are to simulate.
typedefstruct
{
string processName;
int arrivalTime;
int serviceTime;
// holds running count of time slices for current time quantum, when
// serviceTime == quantum, time slice is up
int sliceTime;
// holds total number of time steps currently run, when == to
// serviceTime process is done
int totalTime;
// holds time when process finishes, used to calculate final stats,
// like T_r, T_r/T_s
int finishTime;
// a boolean flag, we will set this to true when the process is complete
bool finished;
}Process;
// Process table, holds table of information about processes we are simulating
typedefstruct
{
int numProcesses;
Process* process[MAX_PROCESSES];
}ProcessTable;
/** Create process table
* Allocate memory for a new process table. Load the process
* information from the simulation file into a table with the process
* information needed to perform the simulation. At the same time we
* initialize other information in process table for use in the
* simulation. Return the newly created ProcessTable
*
* @param processFilanem The name (char*) of the file to open and read
* the process information from.
* @param processTable This is actually a return parameter. This
* should be a pointer to an already allocated array of
* Process structure items. We will fill in this structure
* and return the process information.
*
* @returns ProcessTable* The newly allocated and initialized ProcessTable
* structure.
*/
ProcessTable* createProcessTable(char* processFilename)
{
ifstream simprocessfile(processFilename);
ProcessTable* processTable;
int pid;
string processName;
int arrivalTime;
int serviceTime;
// If we can't open file, abort and let ...
I am Allen K. I am a Computer Science Assignment Help Expert at programminghomeworkhelp.com. I hold a Ph.D. in Programming, The University of Chicago, USA. I have been helping students with their homework for the past 9 years. I solve assignments related to Computer Science.
Visit programminghomeworkhelp.com or email support@programminghomeworkhelp.com.
You can also call on +1 678 648 4277 for any assistance with Computer Science assignments.
I am Jason B. I am a C++ Programming Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from Princeton University, USA. I have been helping students with their homework for the past 5 years. I solve homework related to C++ Programming.
Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with C++ Programming Homework.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
#ifndef RATIONAL_H if this compiler macro is not defined #def.pdfexxonzone
#ifndef RATIONAL_H // if this compiler macro is not defined
#define RATIONAL_H // then define it so this file will not be processed again
#include \"stdafx.h\" // use only for Microsoft Visual Studio C++
#include
using namespace std;
class Rational
{
// Friend functions are actually declared outside the scope of the
// class but have the right to access public and private data and
// member function members that belong to the class. The friend
// function below gives the << operator for ostreams (including cout)
// the ability to output a Rational object by accessing its member data.
friend ostream &operator<< (ostream &out, Rational const &r);
public:
Rational(int num = 0, int denom = 1); // also provides default constructor
Rational add(Rational right);
Rational operator+ (Rational right); // + addition operator
Rational operator+= (Rational right); // += addition assignment operator
Rational operator- (Rational right); // + addition operator
Rational operator-= (Rational right); // += addition assignment operator
void display();
operator double() const; // convert Rational to double
private:
int numerator;
int denominator;
// helper functions are private and not accessible by the main program
int LCD(int v1, int v2);
Rational setRational(int n, int d);
};
#endif
#include \"stdafx.h\"
#include
#include \"Rational.h\"
using namespace std;
// By using the default parameter settings in Rational.h, this
// constructor also provides the default constructor Rational()
Rational::Rational(int num, int denom)
{
setRational(num, denom); // set numerator and denominator, reduce fraction, fix the sign
}
// Helper function to fix a zero denominator and fix the sign if denominator is negative
Rational Rational::setRational(int n, int d) // helper function
{
numerator = n;
denominator = d;
// if denominator == 0 then set it = 1
if (denominator == 0)
denominator = 1;
if (denominator < 0) // if denominator is neg, multiply num and denom by -1
{
numerator = -numerator; // fix sign of numerator +/-
denominator = -denominator; // denominator always +
}
int lcd = LCD(numerator, denominator);
if (denominator != 0)
{
numerator /= lcd;
denominator /= lcd;
}
return *this; // return the current object
}
// find the lowest common divisor using a recursive function
int Rational::LCD(int v1, int v2)
{
if (v2 == 0) return v1;
else return LCD(v2, v1%v2);
}
Rational Rational::add(Rational right)
{
int newNumerator;
int newDenominator;
newNumerator = numerator*right.denominator + right.numerator*denominator;
newDenominator = denominator * right.denominator;
// create a new Rational object and return it
return setRational(newNumerator, newDenominator);
}
// the operator+ method does the same thing as the add method
Rational Rational::operator+ (Rational right)
{
int newNumerator;
int newDenominator;
newNumerator = numerator*right.denominator + right.numerator*denominator;
newDenominator = denominator * right.denominator;
// create a new Rational object and return it
return .
C++ very good for us jvkbivucyyfuvivucyxtcubobicyxyvinoucyvibivuvuvuviviibivufucuvubibibuvibibbbibibibhibobkvucycuvibibibibobobobobobobobobobibobkgxyvibibihobibibibibibibibibibibibibibibibivibivuvuvuvuvuvbobobohobkbkbobkkbcccvgvgvgctctctctcrctcrcrcrcrcrvtvtvtctcrcrcrcrcrcrcrcrcrcrcrcrcrcrctvfvfcfvfvtcrcrct rvtctvtvtcrcrcrcrcrcrcrcrcrcrcrcrctctcrcrcrcrcrcrcrcrcrcrcrcrvrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrcrctvtvtvtvtvtvtctvbvvgghhhbbbbbhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhuhhuuuhuuuuuuhuuuuuuuuuuuujtvtvfvtvtvtvtvfvtctvtcctcfctcrcfcfcf f f cccccccccfccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Similar to Assignment 13assg-13.cppAssignment 13assg-13.cpp @auth.docx (20)
1.Does BPH predispose this patient to cancer2. Why are pati.docxbraycarissa250
1.Does BPH predispose this patient to cancer?
2. Why are patients with BPH at increased risk for urinary tract infections?
3. What would you expect the patient’s PSA level to be after surgery?
4. What is the recommended screening guidelines and treatment for BPH?
5. What are some alternative treatments / natural homeopathic options for treatment?
.
1.Do you think that mass media mostly reflects musical taste, or.docxbraycarissa250
1.
Do you think that mass media mostly reflects musical taste, or does it play a major role in shaping musical taste? Do you feel that today’s music industry enhances or interferes with the relationship between the artist and their audience?
2.
Think of a song or piece of music that has been a part of your life for a long time and expresses your musical identity. Has the significance or “meaning” of that song changed over the years? If so, what has changed in your perception of the song, and what factors in your life - personal, cultural, or other – might have contributed?
The book is music of th peoples of the world
.
1.Discuss theoretical and conceptual frameworks. How are the.docxbraycarissa250
1.
Discuss theoretical and conceptual frameworks. How are they used and how do they support the use of quantitative methods?
2.
List, define, and discuss all threats associated with internal and external validity in quantitative designs. Also, list mechanisms for dealing with the threats and enhancing study validity.
3.
Nursing Paradigm represent a world view and general perspective on the complexities of the real world. The disciplined inquiry in the field of nursing is being conducted through several paradigms.
Discuss your point of view to one paradigm? Explore the aspects of the paradigms that are especially consistent with your view.
need the answer with APA style
references and citation
one of our book references :
Nursing Research- Appraising Evidence for Nursing Practice, 8th Edition by Denise F. Polit, Cheryl Tatano Beck
.
1.Discuss the medical model of corrections. Is this model of c.docxbraycarissa250
1.
Discuss the medical model of corrections. Is this model of corrections still a viable notion? Why or why not?
2.
Some critics have suggested that rehabilitation cannot work, because so many prison inmates never were habilitated to begin with. What is your reaction to this viewpoint? Explain your answer.
3.
What are some of the fundamental assumptions of career criminal programs? What limitations might these assumptions present in our efforts to identify and punish career criminals?
THE BOOK IS Essentials of Corrections Fourth Edition
G. Larry Mays | L. Thomas Winfree Jr.
and four scholarly sources
1.
Dominey, J. (2010). The higher education contribution to police and probation training: essential, desirable or an indulgence?
British Journal of Community Justice, 8
(2), 6.
2.
Schanz, Y. Y. (2013). Perceptions of undergraduate students on criminology and criminal justice education in the United States: An empirical analysis.
International Journal of Criminal Justice Sciences, 8
(2), 105-119.
.
1.Discussion Question How do we perceive sacred spaceplace in Ame.docxbraycarissa250
1. Discussion Question: How do we perceive sacred space/place in American culture? Do you agree with this perception? What would you change?
2. Reading Reflection: Solid ONE-page reflection paper about your thoughts on the reading. This could include a brief summary and your opinion. There are not many guidelines or format (e.g., APA, MLS style) for these weekly reading reflection assignments. But please use 12-point font, Times New Roman, and don't get ridiculous with the margin settings.
Reading: David Chidester and Edward T. Linenthal (file uploaded)
Lecture: Religious Spaces in Modernity (file uploaded)
Video: https://www.youtube.com/watch?v=wuI47gXGUvc
.
1.Cybercriminals use many different types of malware to attack s.docxbraycarissa250
1.
Cybercriminals use many different types of malware to attack systems. Select one common type of malware listed in this article link and using your own words, explain how to defend yourself against it.
https://www.esecurityplanet.com/malware/malware-types.html#maliciousmobileapp
Post must be between 250-300 words
2.
Using the following link as your reference, select TWO and explain the differences
(viruses, worms, trojans, and bots).
https://tools.cisco.com/security/center/resources/virus_differences
Post must be between 250-300 words
3.
Describe two cryptographic applications and how they are used in Information System Security.
Post must be between 250-300 words
.
1.Define emotional intelligence. What are the benefits of emotional .docxbraycarissa250
1.Define emotional intelligence. What are the benefits of emotional intelligence? Why should
emotional intelligence be taught to children at a very young age?
2.Discuss in detail the role of self awareness in becoming emotionally intelligent. What is self
awareness and how do we become self aware? What role does honesty and transparency play
in this process?
3.Discuss in detail the role of self management in becoming emotionally intelligent. What is self
management and what does it look like when we self manage our lives? Explain how this might
be the area of emotional intelligence where we most often fail.
4.Discuss in detail the role of social awareness in emotional intelligence. What is social
awareness. How can we become more socially aware? How does this step indicate a move
outside of ourselves and begin our interaction with others?
5.Discuss in detail the role of relationship building in emotional intelligence. What does
relationship building involve? Identify several key things that can be done to build relationships
both inside and outside your family .
.
1.Define Strategic Planning and Swot Analysis2.List and define.docxbraycarissa250
1.Define Strategic Planning and Swot Analysis
2.List and define the 4 Parameters of Swat Analysis
3.Briefly describe the four steps in conducting a swot analysis.
*Short APA Word Format Attached (5 points)
Font: Times New Roman, Font Size: 12,
Spacing: Double. Justification: Left, Cited Sentences. Minimum 250 Words (excludes questions), Minimum 2-3 Pages with references*
.
1.Choose a writer; indicate hisher contribution to the Harlem Renai.docxbraycarissa250
1.Choose a writer; indicate his/her contribution to the Harlem Renaissance.2.Identify a theme associated with that writer. You may choose from those listed below or finda theme on your own.3.Provide a poem, fictional piece, or non-fiction piece (or excerpt) by your author. Choose a work not discussed in class. 4.Formulate a thesis statement about your author’s presentation of the theme.5.Establish at least three main points to develop your discussion of the author’s effective presentation of the theme.6.Use at least six illustrative quotes to support your discussion.
WRITERS:Claude McKayGwendolyn BennettArnaBontempsSterling A. BrownCounteeCullenW. E. B. Du BoisRalph Waldo EllisonJessie Redmon FausetRudolph FisherLangston HughesZora Neale HurstonCharles S. JohnsonGeorgia Douglas JohnsonJames Weldon JohnsonNella LarsenAlain LeRoy LockeClaude McKayRichard Bruce NugentJoel Augustus RogersGeorge S. SchuylerWallace ThurmanJean ToomerCarl Van VechtenDorothy Wes
SOME COMMON THEMES:•pride in African ancestry•influence of the experience of slavery •emerging African-American folk traditions on black identity •the effects of institutional racism •the dilemmas inherent in performing and writing for elite white audiences•the question of how to convey the experience of modern black life in the urban North
.
1.Being sure that one has the resources necessary to accomplish the .docxbraycarissa250
1.Being sure that one has the resources necessary to accomplish the goals is an essential step. Preparation is very important. Without all of the necessary resources one cannot succeed. I know people that are very organized with their life and the time that they have every day. The values and mission are clear and their goals and objectives align with their life course. Each hour of the day is focused on using their short-term goals to reach their long-term goal that is consistent with their mission and values. The key here is that they took the time to do the work to explore what it is they really wanted in life and what was important in all of their roles to arrive at this plan. How many of us have a well-crafted life plan?
2.Please be reminded that information in the post that is not original content should be supported with references. There is a difference between goals setting and deadlines. Deadlines indicate that a task must be completed at a certain time. The task may or may not be a part of a goal. Where as goals have time lines to assure that that are completed in a certain time. Are there other examples of the difference.
.
1.Based on how you will evaluate your EBP project, which indepen.docxbraycarissa250
1.
Based on how you will evaluate your EBP project, which independent and dependent variables do you need to collect? Why?
2.
Not all EBP projects result in statistically significant results. Define clinical significance, and explain the difference between clinical and statistical significance. How can you use clinical significance to support positive outcomes in your project?
.
1.Be organized. 2. Spend less time doing a summary, but more o.docxbraycarissa250
1.Be organized.
2. Spend less time doing a summary, but more on your thoughts, ideas, and arguments.
3. What approach can you use in doing literary analysis? Study approaches such as structuralism (look for patterns), Marxism (relation of text to society), reader response, feminist thought, deconstruction (what are the gaps and fizzures in the text, what is it really about?) , etc.
4. Focus on details. For example, discuss a particular character or scene in a story, or an image in a poem.
5. Consider doing an intertextual analysis. For example, you can compare the texts/s in class to a photograph you saw, a film you watched or another text from another culture.
.
1.After discussion with your preceptor, name one financial aspec.docxbraycarissa250
1.
After discussion with your preceptor, name one financial aspect, one quality aspect, and one clinical aspect that need to be taken into account for developing the evidence-based change proposal. Explain how your proposal will directly and indirectly impact each of the aspects.
2.
Now that you have completed a series of assignments that have led you into the active project planning and development stage for your project, briefly describe your proposed solution to address the problem, issue, suggestion, initiative, or educational need and how it has changed since you first envisioned it. What led to your current perspective and direction?
.
1.A 52-year-old obese Caucasian male presents to the clinic wit.docxbraycarissa250
1.
A 52-year-old obese Caucasian male presents to the clinic with a 2-day history of fever, chills, and right great toe pain that has gotten worse. Patient states this is the first time that this has happened, and nothing has made it better and walking on his right foot makes it worse. He has tried acetaminophen, but it did not help. He took several ibuprofen tablets last night which did give him a bit of relief. Past medical history positive or hypertension treated with hydrochlorothiazide and kidney stones. Social history negative for tobacco use but admits to drinking “a fair amount of red wine” every week. General appearance: Ill appearing male who sits with his right foot elevated. Physical exam remarkable for a temp of 101.2, pulse 108, respirations 18 and BP 160/88. Right great toe (first metatarsal phalangeal [MTP]) noticeably swollen and red. Unable to palpate to assess range of motion due to extreme pain. CBC and Complete metabolic profile revealed WBC 14,000 mm3 and uric acid 8.9 mg/dl. The APRN diagnoses the patient with acute gout.
Question 1 of 2:
Describe the pathophysiology of gout.
QUESTION 2
1. A 52-year-old obese Caucasian male presents to the clinic with a 2-day history of fever, chills, and right great toe pain that has gotten worse. Patient states this is the first time that this has happened, and nothing has made it better and walking on his right foot makes it worse. He has tried acetaminophen, but it did not help. He took several ibuprofen tablets last night which did give him a bit of relief. Past medical history positive or hypertension treated with hydrochlorothiazide and kidney stones. Social history negative for tobacco use but admits to drinking “a fair amount of red wine” every week. General appearance: Ill appearing male who sits with his right foot elevated. Physical exam remarkable for a temp of 101.2, pulse 108, respirations 18 and BP 160/88. Right great toe (first metatarsal phalangeal [MTP]) noticeably swollen and red. Unable to palpate to assess range of motion due to extreme pain. CBC and Complete metabolic profile revealed WBC 14,000 mm3 and uric acid 8.9 mg/dl. The APRN diagnoses the patient with acute gout.
Question 2 of 2:
Explain why a patient with gout is more likely to develop renal calculi. 1 points
QUESTION 3
1. Stan is a 45-year-old man who presents to the clinic complaining of intermittent fevers, joint pain, myalgias, and generalized fatigue. He noticed a rash several days ago that seemed to appear and disappear on different parts of his abdomen. He noticed the lesion below this morning and decided to come in for evaluation. He denies recent international travel and the only difference in his usual routine was clearing some underbrush from his back yard about a week ago. Past medical history non-contributory with exception of severe allergy to penicillin resulting in hives and difficulty breathing. Physical exam: Temp 101.1 ˚F, BP 128/72, pulse 102 and regular, respirations .
1.1Arguments, Premises, and ConclusionsHow Logical Are You·.docxbraycarissa250
1.1Arguments, Premises, and Conclusions
How Logical Are You?
· After a momentary absence, you return to your table in the library only to find your smartphone is missing. It was there just minutes earlier. You suspect the student sitting next to you took it. After all, she has a guilty look. Also, there is a bulge in her backpack about the size of your phone, and one of the pouches has a loose strap. Then you hear a “ring” come from the backpack—and it’s the same ringtone that you use on your phone. Which of these pieces of evidence best supports your suspicion?
Answer
The best evidence is undoubtedly the “ring” you hear coming from her backpack, which is the same ringtone as the one on your phone. The weakest evidence is probably the “guilty look.” After all, what, exactly, is a guilty look? The bulge in the backpack and the loose strap are of medium value. The loose strap supports the hypothesis that something was quickly inserted into the backpack. In this section of the chapter you will learn that evidentiary statements form the premises of arguments.
Logic may be defined as the organized body of knowledge, or science, that evaluates arguments. All of us encounter arguments in our day-to-day experience. We read them in books and newspapers, hear them on television, and formulate them when communicating with friends and associates. The aim of logic is to develop a system of methods and principles that we may use as criteria for evaluating the arguments of others and as guides in constructing arguments of our own. Among the benefits to be expected from the study of logic is an increase in confidence that we are making sense when we criticize the arguments of others and when we advance arguments of our own.
An argument, in its simplest form, is a group of statements, one or more of which (the premises) are claimed to provide support for, or reasons to believe, one of the others (the conclusion). Every argument may be placed in either of two basic groups: those in which the premises really do support the conclusion and those in which they do not, even though they are claimed to. The former are said to be good arguments (at least to that extent), the latter bad arguments. The purpose of logic, as the science that evaluates arguments, is thus to develop methods and techniques that allow us to distinguish good arguments from bad.
As is apparent from the given definition, the term argument has a very specific meaning in logic. It does not mean, for example, a mere verbal fight, as one might have with one’s parent, spouse, or friend. Let us examine the features of this definition in greater detail. First of all, an argument is a group of statements. A statement is a sentence that is either true or false—in other words, typically a declarative sentence or a sentence component that could stand as a declarative sentence. The following sentences are statements:
Chocolate truffles are loaded with calories.
Melatonin helps relieve jet lag.
Political can.
1.4 Participate in health care policy development to influence nursi.docxbraycarissa250
1.4 Participate in health care policy development to influence nursing practice and health care.
Research public health issues on the "Climate Change" or "Topics and Issues" pages of the American Public Health Association (APHA) website. Investigate a public health issue related to an environmental issue within the U.S. health care delivery system and examine its effect on a specific population.
Write a 750-1,000-word policy brief that summarizes the issue, explains the effect on the population, and proposes a solution to the issue.
Follow this outline when writing the policy brief:
Describe the policy health issue. Include the following information: (a) what population is affected, (b) at what level does it occur (local, state, or national), and (c) evidence about the issues supported by resources.
Create a problem statement.
Provide suggestions for addressing the health issue caused by the current policy. Describe what steps are required to initiate policy change. Include necessary stakeholders (government officials, administrator) and budget or funding considerations, if applicable.
Discuss the impact on the health care delivery system.
Include three peer-reviewed sources and two other sources to support the policy brief.
Prepare this assignment according to the guidelines found in the APA Style Guide, located in the Student Success Center. An abstract is not required.
This assignment uses a rubric. Please review the rubric prior to beginning the assignment to become familiar with the expectations for successful completion.
You are required to submit this assignment to LopesWrite. Refer to the
LopesWrite Technical Support articles
for assistance.
.
1.5 - 2 pages single-spaced. Use 1-inch margins, 12 font, Microsoft .docxbraycarissa250
1.5 - 2 pages single-spaced. Use 1-inch margins, 12 font, Microsoft Word. Try to cite 5 things/readings from the class, but use them in an incisive way.
Cite sources according to your preference style (footnote/endnotes or in-text parenthetical citations with author last names and page numbers for academic direct quotes). Question to answer: how is statelessness related to refugeeness? How are they similar or different? Make an argument that can tie those things together. Be more specific than general (don’t just say they are both discriminated and ignored groups, show or describe to me how is works). How are they both global/local issues? Basically, people think they know who or what global refugees/stateless people are.
.
1.5 Pages on the following topics Diversity, Race and Gender Equity.docxbraycarissa250
1.5 Pages on the following topics: Diversity, Race and Gender Equity
APA Format. This should flow like an article to breakdown the differences between equity and equality. Specifically highlight the components of diversity, race and gender equity, and how they play a role in justice.
.
1.0. Introduction Effective project management is consid.docxbraycarissa250
1.0. Introduction
Effective project management is considered an essential part of a company’s way to
success, as, to put it simply, its main purpose is to predict any risk that might affect a
project of a company and prepare the latter for it (Lock, 2013).
Since 2010, Netflix, world-leading subscription video on-demand streaming service,
has been producing its own content, such as series and full-length movies (Netflix,
2019). Such Original series or films could be considered as separate projects, which
are now the key to attracting new audiences and keeping existing Netflix subscribers
(Schomer, 2018). Therefore, it is critical for Netflix to make sure that all these projects
are carefully planned and are executed in a way as smooth as possible.
The aim of this report is to analyse the project management process of “Bird Box”, the
most successful Netflix movie project by far, thus gaining useful transferable
knowledge and providing recommendations for future similar projects.
1.1. Project Background
“Bird Box” is a 2018 movie produced by Netflix, which makes the film a so-called Netflix
Original, meaning it is available only on Netflix (Netflix, 2019; Netflix Media Center,
2019).
“Bird Box” is a sci-fi psychological drama thriller, which tells a story of a woman and
two children trying to survive in an apocalyptic world (Netflix, 2019). It premiered on
21st December 2018 (Netflix Media Center, 2019).
The movie is based on the eponymous novel by Josh Malerman, published in 2014
(Slauer, 2018).
Leading role in the film is performed by Sandra Bullock with the director being Susanne
Bier – both Academy Awards® winners (Netflix Media Center, 2019).
“Bird Box” became the most successful Netflix Original movie so far. Although it was
not highly appraised by critics, it generated significant amount of conversations and
feedback in social media and is the most watched Netflix Original movie at the moment
of writing (Lee, 2019).
Page 2 of 22
2.0. Project Management Landscape
According to Wysocki (2014), “a project is a sequence of unique, complex, and
connected activities that have one goal or purpose and that must be completed by a
specific time, within budget, and according to specification”. Following from this
definition, every project should have a goal and a solution.
Regarding goal, Netflix creates its own movies and series as a part of its vertical
integration strategy. Indeed, replacing licensed content with its own not only eliminates
the cost Netflix would otherwise have spent on licensing but also helps make the
service unique, thus keeping existing subscribers and attracting new ones (Ball, 2013).
Therefore, it could be stated that the goal of “Bird Box” is to support Netflix’s “worth-
to-watch, unique content” strategy and encourage more subscriptions to the service
(Nicolaou, 2019).
As for solution, firstly, the movie is based on a novel, which has alr.
1.1 What is the OSI security architecture1.2 What is the differ.docxbraycarissa250
1.1 What is the OSI security architecture?
1.2 What is the difference between passive and active security threats?
1.3 List and briefly define categories of passive and active security attacks.
1.4 List and briefly define categories of security services.
1.5 List and briefly define categories of security mechanisms.
1.6 List and briefly define the fundamental security design principles.
1.7 Explain the difference between an attack surface and an attack tree.
.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
1. Assignment 13/assg-13.cppAssignment 13/assg-13.cpp/**
* @author Jane Programmer
* @cwid 123 45 678
* @class COSC 2336, Spring 2019
* @ide Visual Studio Community 2017
* @date April 8, 2019
* @assg Assignment 13
*
* @description Assignment 13 Dictionaries and Hash table
* implementations.
*/
#include<cassert>
#include<iostream>
#include"KeyValuePair.hpp"
#include"Employee.hpp"
#include"HashDictionary.hpp"
usingnamespace std;
/** main
* The main entry point for this program. Execution of this pro
gram
* will begin with this main function.
*
* @param argc The command line argument count which is the
number of
* command line arguments provided by user when they starte
d
* the program.
* @param argv The command line arguments, an array of chara
cter
* arrays.
2. *
* @returns An int value indicating program exit status. Usuall
y 0
* is returned to indicate normal exit and a non-zero value
* is returned to indicate an error condition.
*/
int main(int argc,char** argv)
{
// -----------------------------------------------------------------------
cout <<"-----
testing Employee record and KeyValuePair class -----------
"<< endl;
KeyValuePair<int, string> pair(42,"blue");
cout <<"test key: "<< pair.key()<< endl;
assert(pair.key()==42);
cout <<"test value: "<< pair.value()<< endl;
assert(pair.value()=="blue");
int id =3;
Employee e(id,"Derek Harter","1234 Main Street, Commerce T
X",12345.67);
cout << e << endl;
assert(e.getId()==3);
assert(e.getName()=="Derek Harter");
cout << endl;
// -----------------------------------------------------------------------
cout <<"-------------- testing quadratic probing ------------------
-----"<< endl;
constint TABLE_SIZE =7;
HashDictionary<int,Employee> dict(TABLE_SIZE, EMPTY_E
MPLOYEE_ID);
cout <<"Newly created hash dictionary should be empty, size:
"<< dict.size()<< endl;
3. assert(dict.size()==0);
int probeIndex =0;
//cout << "probe index: " << probeIndex
// << " returned probe value: " << dict.probe(id, probeIndex)
// << endl;
//assert(dict.probe(id, probeIndex) == 2);
probeIndex =1;
//cout << "probe index: " << probeIndex
// << " returned probe value: " << dict.probe(id, probeIndex)
// << endl;
//assert(dict.probe(id, probeIndex) == 5);
probeIndex =5;
//cout << "probe index: " << probeIndex
// << " returned probe value: " << dict.probe(id, probeIndex)
// << endl;
//assert(dict.probe(id, probeIndex) == 37);
cout << endl;
// -----------------------------------------------------------------------
cout <<"-------------- testing mid-square hashing ---------------
-------"<< endl;
// the following asserts will only work for 32 bit ints, leave asse
rts
// commented out if you have 64 bit asserts
cout <<"Assuming 32 bit (4 byte) ints for these tests: "<<sizeo
f(int)<< endl;
assert(sizeof(int)==4);
//id = 3918;
//cout << "hash key: " << id
// << " returned hash value: " << dict.hash(id)
// << endl;
4. //assert(dict.hash(id) == 1);
//id = 48517;
//cout << "hash key: " << id
// << " returned hash value: " << dict.hash(id)
// << endl;
//assert(dict.hash(id) == 6);
//id = 913478;
//cout << "hash key: " << id
// << " returned hash value: " << dict.hash(id)
// << endl;
//assert(dict.hash(id) == 5);
//id = 8372915;
//cout << "hash key: " << id
// << " returned hash value: " << dict.hash(id)
// << endl;
//assert(dict.hash(id) == 4);
// test that the distribution of the hash values
// over the possible slots/buckets looks relatively
// evenly distributed
int counts[TABLE_SIZE]={0};
//for (id = 0; id < 1000000; id++)
//{
// int hash = dict.hash(id);
// counts[hash]++;
//}
// display results
int sum =0;
for(int slot =0; slot < TABLE_SIZE; slot++)
{
cout <<"counts for slot["<< slot <<"] = "
<< counts[slot]<< endl;
5. sum = sum + counts[slot];
}
// spot check results
//assert(sum == 1000000);
//assert(counts[0] == 143055);
//assert(counts[6] == 142520);
cout << endl;
// -----------------------------------------------------------------------
cout <<"-------------- testing dictionary insertion ---------------
-----"<< endl;
id =438901234;
//dict.insert(id, Employee(id, "Derek Harter", "123 Main St. Co
mmerce TX", 58.23));
id =192834192;
//dict.insert(id, Employee(id, "Alice White", "384 Bois'darc. Ca
mpbell TX", 45.45));
id =998439281;
//dict.insert(id, Employee(id, "Bob Green", "92 Washington Apt
. 5 Greenville TX", 16.00));
id =362817371;
//dict.insert(id, Employee(id, "Carol Black", "8913 FM 24 Coop
er TX", 28.50));
cout <<"After inserting "<< dict.size()<<" employees:"<< endl
;
cout << dict << endl;
// spot check that hash table entries were correctly performed
//assert(dict.size() == 4);
//assert(dict[3].key() == 192834192);
//assert(dict[3].value().getName() == "Alice White");
//assert(dict[1].key() == 438901234);
//assert(dict[1].value().getName() == "Derek Harter");
cout << endl;
6. // -----------------------------------------------------------------------
cout <<"-------------- testing dictionary search ------------------
-----"<< endl;
id =438901234;
//e = dict.find(id);
//cout << "Search for id: " << id << endl;
//cout << " Found employee: " << e << endl;
//assert(e.getId() == id);
//assert(e.getName() == "Derek Harter");
id =362817371;
//e = dict.find(id);
//cout << "Search for id: " << id << endl;
//cout << " Found employee: " << e << endl;
//assert(e.getId() == id);
//assert(e.getName() == "Carol Black");
id =239481432;
//e = dict.find(id);
//cout << "Unsuccessful Search for id: " << id << endl;
//cout << " Found employee: " << e << endl;
//assert(e.getId() == EMPTY_EMPLOYEE_ID);
//assert(e.getName() == "");
cout << endl;
// return 0 to indicate successful completion
return0;
}
Assignment 13/assg-13.pdf
Assg 13: Dictionaries and Hashing
7. COSC 2336 Spring 2019
April 18, 2019
Dates:
Due: Sunday May 05, by Midnight
Objectives
• More practice with using class templates
• Learn about implementing and using key/value pair Dictionary
ab-
straction
• Implement and learn about some basic hashing techniques,
like mid-
square hasing and quadratic probing for closed hashing
schemes.
Description
In this assignment you will be implementing some basic
mechanisms of a
hash table to implement a Dictionary that uses hashing to store
and search
for items in its collection. You have been given many files for
this assign-
ment. I have provided an Employee class in
"Employee.[hpp|cpp]" and a
KeyValuePair class in "KeyValuePair.[hpp|cpp]". You will not
need to make
any changes to these files or classes, they should work as given
for this as-
8. signment.
You will be adding and implementing some member functions to
the
HashDictionary class. The initial "HashDictionary.[hpp|cpp]"
file contains
a constructor and destructor for a HashDictionary as well as
some other
accessors and operators already implemented that are used for
testing.
You will be implementing a closed hash table mechanism using
quadratic
probing of the slots. You will also implement a version of the
mid-square
1
hashing function described in our textbook (Shaffer section
9.4.3 on closed
hashing mechinsms).
For this assignment you need to perform the following tasks.
1. Your first task is to implement methods to define the probe
sequence
for closed hasing. Add a member function named probe() to the
HashDictionary class. Be aware that the HashDictionary class is
a templatized on <Key, Value> templates, thus when you
implement
the class methods you need to templatize the class methods
correctly.
You can look at the example implementations of size() and the
con-
9. structors to remind yourself how to do this correctly.
In any case, probe() is a member function that takes two
parameters,
a Key and an integer index value. We are not using secondary
hashing
(as described in our textbook) so the Key value will actually not
be
used in your function. However, keep it as a parameter as the
gen-
eral abstraction/API for the probe function should include it for
cases
where secondary hashing is used. probe() should be a const
class
member function, as calling it does not change the dictionary.
Finally
probe() will return an ineger as its result.
Your probe() funciton should implement a quadratic probing
scheme
as described in our Shaffer textbook section 9.4.3 on pg. 338.
Use
c1 = 1, c2 =2, c3 = 2 as the parameters for your quadratic probe
(the tests of probe() assume your probe sequence is using these
pa-
rameter values for the quadratic function).
2. You second tasks is to implement a hash function for integer
like keys
using the described mid-square hasing function (Shaffer 9.4.1
Example
9.6 pg. 327). We will create a slight variation of this algorithm
for our
hashing dictionary. First of all the hash() member functions
should
take a Key as its only input parameter, and it will then return a
10. regular
int as its result. Since this is a hash function, the integer value
should
be in the range 0 - tableSize-1, so don’t forget to mod by the
tableSize before returning your hash result.
hash() should work like this. First of all, you should square the
key
value that is passed in. Then, assuming we are working with a
32 bit
int, we want to only keep the middle 16 bits of the square of the
key
to use for our hash. There are many ways to work with and get
the
bits you need, but most likely you will want to use C bitwise
operators
to do this. For example, a simple method to get the middle 16
bits is
2
to first mask out the upper 8 bits using the bitwise & operator
(e.g.
key & 0x00FFFFFF) will mask out the high order 8 bits to 0).
Then
once you have removed the upper most significant 8 bits, you
can left
shift the key by 8 bits, thus dropping out the lower least
significant
8 bits (e.g. key >> 8). Performing a mask of the upper 8 bits and
shifting out the lower 8 bits will result in you only retaining the
middle
16 bits.
11. If your system is using 64 bit integers rather than 32 bit
integers,
perform the mid-square method but retain the middle 32 bits of
the
result. You can use the sizeof(int) method to determine how
many
bytes are in an int on your system. I will give a bonus point if
you
write your hash() function to correctly work for both 32 and 64
bit
values by testing sizeof(int) and doing the appopriate work to
get
the middle bits. Again after you square the key and get the
middle
bits, make sure you modulo the result to get an actual has index
in the
correct range.
3. The third task is to add the insert() method to your
HashDictionary
so that you can insert new key/value pairs into the dictionary.
insert() should take a constant Key reference and a constant
Value
reference as its input parameters (note that both of these
parameters
should be declared as const, and they should both be reference
pa-
rameters, so use the & to indicate they are passed by reference).
Your
insert() function does not return a result, so it will be a void
func-
tion.
The algorithm for insert is described in Shaffer 9.4.3 on pg.
334. You
need to call and use the probe() and hash() funciton you created
12. in the first 2 steps to correctly define/implement your closed
hashing
probe sequence. The basica algorithm is that you use hash() to
de-
termine the initial home slot, and probe() gives an offset you
should
add. Basically you have to search the hashTable using the probe
se-
quence until you find an empty slot. Once you find an empty
slot, you
should create a new instance of a KeyValuePair<Key, Value>
object,
that contains the key and value that were provided as input
param-
eters to your insert() function. This KeyValuePair instance
should
then be inserted into the table at the location where you find the
first
empty slot on the probe sequence. Also don’t forget to update
the
valueCount paramemter of the HashDictionary class that keeps
track
of the number of items currently in the dictionary.
3
4. Finally you will also implement the find() method to search
for a
particular key in your dictionary. The find() member function
taks
a single Key parameter as input (it should be a const Key&
reference
parameter). The find() functin will return a Value as a result,
which
13. will be the Value of the record associated with the given Key if
it was
found in the dictionary, or an empty Value() object if it was not
found.
The find() method uses the same probe sequence as insert()
imple-
mented by your probe() and hash() methods. So you should
again
search along the probe sequence, until you either find the key
you were
given to search for, or else find an empty slot. Then at the end,
if
you found the key in the hashTable you should return the value
that
corresponds to the key that was searched for. If the search
failed and
you found an empty slot on your probe sequence, you should
instead
return an empty Value() object, which is used as an indicator
for a
failed search.
In this assignment you will be given a lot of starting code. As
usual, there is an "assg-13.cpp" file which contains commented
out tests
of the code/functions you are to write. You have been given and
"Em-
ployee.[hpp|cpp]" file containing a simple definition of a (non-
templated)
class/record that holds a few pieces of information about a
theoretical
Employee. We use this class to create a hash dictionary for
testing with
the employee id as the key, and the Employee record as the
associated value
14. in our Dictionary. You have also been given a template class in
the file
"KeyValuePair.[hpp|cpp]". This contains a templatized
container to holding
a key/value pair of items. You will not need to add any code or
make any
changes in the Employee or KeyValuePair class files.
You have also been given a "HashDictionary.[hpp|cpp]" file
containing
beginning defintions of a HashDictionary class. The member
functions you
need to add for this assignment should be added to these files.
Here is an example of the output you should get if your code is
passing
all of the tests and is able to run the simulation. You may not
get the
exact same statistics for the runSimulation() output, as the
simulation is
generating random numbers, but you should see similar values.
----- testing Employee record and KeyValuePair class -----------
test key: 42
test value: blue
( id: 3, Derek Harter, 1234 Main Street, Commerce TX,
12345.67 )
4
-------------- testing quadratic probing -----------------------
Newly created hash dictionary should be empty, size: 0
probe index: 0 returned probe value: 2
probe index: 1 returned probe value: 5
15. probe index: 5 returned probe value: 37
-------------- testing mid-square hashing ----------------------
Assuming 32 bit (4 byte) ints for these tests: 4
hash key: 3918 returned hash value: 1
hash key: 48517 returned hash value: 6
hash key: 913478 returned hash value: 5
hash key: 8372915 returned hash value: 4
counts for slot[0] = 143055
counts for slot[1] = 143040
counts for slot[2] = 143362
counts for slot[3] = 142399
counts for slot[4] = 142966
counts for slot[5] = 142658
counts for slot[6] = 142520
-------------- testing dictionary insertion --------------------
After inserting 4 employees:
Slot: 0
Key : 362817371
Value: ( id: 362817371, Carol Black, 8913 FM 24 Cooper TX,
28.50 )
Slot: 1
Key : 438901234
Value: ( id: 438901234, Derek Harter, 123 Main St. Commerce
TX, 58.23 )
Slot: 2
Key : 0
Value: ( id: 0, , , 0.00 )
Slot: 3
Key : 192834192
Value: ( id: 192834192, Alice White, 384 Bois'darc. Campbell
16. TX, 45.45 )
Slot: 4
5
Key : 998439281
Value: ( id: 998439281, Bob Green, 92 Washington Apt. 5
Greenville TX, 16.00 )
Slot: 5
Key : 0
Value: ( id: 0, , , 0.00 )
Slot: 6
Key : 0
Value: ( id: 0, , , 0.00 )
-------------- testing dictionary search -----------------------
Search for id: 438901234
Found employee: ( id: 438901234, Derek Harter, 123 Main St.
Commerce TX, 58.23 )
Search for id: 362817371
Found employee: ( id: 362817371, Carol Black, 8913 FM 24
Cooper TX, 28.50 )
Unsuccessful Search for id: 239481432
Found employee: ( id: 0, , , 0.00 )
Assignment Submission
A MyLeoOnline submission folder has been created for this
17. assignment. You
should attach and upload your completed
"HashDictionary.[hpp|cpp]" source
files to the submission folder to complete this assignment. You
do not need
to submit your "assg-13.cpp" file with the tests, nor the
Employee or KeyVal-
uePair files, since you should not have made changes to any of
these (except
to uncomment out the tests in assg-13.cpp). Please only submit
the asked
for source code files, I do not need your build projects,
executables, project
files, etc.
6
Requirements and Grading Rubrics
Program Execution, Output and Functional Requirements
1. Your program must compile, run and produce some sort of
output to
be graded. 0 if not satisfied.
2. (20 pts.) probe() member function implemented. Function is
using
quadratic probing as asked for, with correct values for c1, c2
and c3
parameters. Probe sequence appears correct and passes tests.
3. (20 pts.) hash() member function implemented correctly.
Function
implements the mid-square method as described. Function
18. correctly
uses only the 16 middle bits if system uses 32 bit integers.
4. (30 pts.) insert() member function implemented and working.
Func-
tion appears to be correctly generating probe sequence using the
probe() and hash() functions. Items are correctly inserted into
ex-
pected location in the hash table.
5. (30 pts.) find() member function implemented and working.
Function
appears to be also correctly using the probe sequence in the
same was
as insert(). Function passes the expected tests.
Program Style
Your programs must conform to the style and formatting
guidelines given
for this class. The following is a list of the guidelines that are
required for
the assignment to be submitted this week.
1. Most importantly, make sure you figure out how to set your
indentation
settings correctly. All programs must use 2 spaces for all
indentation
levels, and all indentation levels must be correctly indented.
Also all
tabs must be removed from files, and only 2 spaces used for
indentation.
2. A function header must be present for member functions you
define.
You must give a short description of the function, and document
19. all of
the input parameters to the function, as well as the return value
and
data type of the function if it returns a value for the member
functions,
just like for regular functions. However, setter and getter
methods do
not require function headers.
7
3. You should have a document header for your class. The class
header
document should give a description of the class. Also you
should doc-
ument all private member variables that the class manages in
the class
document header.
4. Do not include any statements (such as system("pause") or
inputting
a key from the user to continue) that are meant to keep the
terminal
from going away. Do not include any code that is specific to a
single
operating system, such as the system("pause") which is
Microsoft
Windows specific.
8
Assignment 13/Employee.cppAssignment 13/Employee.cpp/**
* @author Jane Programmer
20. * @cwid 123 45 678
* @class COSC 2336, Spring 2019
* @ide Visual Studio Community 2017
* @date April 8, 2019
* @assg Assignment 13
*
* @description Simple example of an Employee record/class
* we can use to demonstrate HashDictionary key/value pair
* management.
*/
#include<string>
#include<iostream>
#include<iomanip>
#include<sstream>
#include"Employee.hpp"
usingnamespace std;
/** constructor
* Default constructor for our Employee record/class. Construct
an
* empty employee record
*/
Employee::Employee()
{
this->id = EMPTY_EMPLOYEE_ID;
this->name ="";
this->address ="";
this->salary =0.0;
}
/** constructor
* Basic constructor for our Employee record/class.
*/
Employee::Employee(int id, string name, string address,float sal
21. ary)
{
this->id = id;
this->name = name;
this->address = address;
this->salary = salary;
}
/** id accessor
* Accessor method to get the employee id.
*
* @returns int Returns the integer employee id value.
*/
intEmployee::getId()const
{
return id;
}
/** name accessor
* Accessor method to get the employee name.
*
* @returns string Returns the string containing the full
* employee name for this record.
*/
string Employee::getName()const
{
return name;
}
/** overload operator<<
* Friend function to ouput representation of Employee to an
* output stream.
*
22. * @param out A reference to an output stream to which we sho
uld
* send the representation of an employee record for display.
* @param employee The reference to the employee record to be
displayed.
*
* @returns ostream& Returns a reference to the original output
* stream, but now the employee information should have been
* inserted into the stream for display.
*/
ostream&operator<<(ostream& out,Employee& employee)
{
//out << "Employee id: " << employee.id << endl
// << " name : " << employee.name << endl
// << " address: " << employee.address << endl
// << " salary : " << fixed << setprecision(2) << employee.s
alary << endl;
out <<"( id: "<< employee.id <<", "
<< employee.name <<", "
<< employee.address <<", "
<< fixed << setprecision(2)<< employee.salary <<" )"<< endl;
return out;
}
Assignment 13/Employee.hpp
/**
* @author Jane Programmer
* @cwid 123 45 678
* @class COSC 2336, Spring 2019
* @ide Visual Studio Community 2017
* @date April 8, 2019
* @assg Assignment 13
*
* @description Simple example of an Employee record/class
23. * we can use to demonstrate HashDictionary key/value pair
* management.
*/
#include <string>
#include <iostream>
using namespace std;
#ifndef EMPLOYEE_HPP
#define EMPLOYEE_HPP
// This should really be a class constant, however this
// global constant represents a flag that is used to
// indicate empty slots and/or failed search.
const int EMPTY_EMPLOYEE_ID = 0;
/** Employee
* A simple Employee class/record to demonstrate/test
* our hashing dictionary assignment.
* NOTE: we are using 0 as a flag to represent an unused
* slot or an invalid/empty employee. This is used/assumed
* by our dictionary class to determine if a slot is empty
* and/or to give a failure result for a failed search.
*/
class Employee
{
private:
int id;
string name;
string address;
float salary;
public:
Employee();
Employee(int id, string name, string address, float salary);
24. int getId() const;
string getName() const;
friend ostream& operator<<(ostream& out, Employee&
employee);
};
#endif // EMPLOYEE_HPP
Assignment 13/HashDictionary.cppAssignment
13/HashDictionary.cpp/**
* @author Jane Programmer
* @cwid 123 45 678
* @class COSC 2336, Spring 2019
* @ide Visual Studio Community 2017
* @date April 8, 2019
* @assg Assignment 13
*
* @description Template class for definining a dictionary
* that uses a hash table of KeyValuePair items.
* Based on Shaffer hashdict implementation pg. 340
*/
/** constructor
* Standard constructor for the HashDictionary
*
* @param tableSize The size of the hash table that should be
* generated for internal use by this dictionary for hasing.
* @param emptyKey A special flag/value that can be used to d
etect
* invalid/unused keys. We need this so we can indicate which
* slots/buckets in our hash table are currently empty, and also
* this value is used as a return result when an unsuccessful
25. * search is performed on the dictionary.
*/
template<classKey,classValue>
HashDictionary<Key,Value>::HashDictionary(int tableSize,Key
emptyKey)
{
this->tableSize = tableSize;
this->EMPTYKEY = emptyKey;
valueCount =0;
// allocate an array/table of the indicated initial size
hashTable =newKeyValuePair<Key,Value>[tableSize];
// initialize the hash table so all slots are initially empty
for(int index =0; index < tableSize; index++)
{
hashTable[index].setKey(EMPTYKEY);
}
}
/** destructor
* Standard destructor for the HashDictionary. Be good memor
y managers and
* free up the dynamically allocated array of memory pointed to
by hashTable.
*/
template<classKey,classValue>
HashDictionary<Key,Value>::~HashDictionary()
{
delete[] hashTable;
}
/** size
* Accessor method to get the current size of this dictionary,
26. * e.g. the count of the number of key/value pairs currently bein
g
* managed in our hash table.
*
* @returns in Returns the current number of items being manag
ed by
* this dictionary and currently in our hashTable.
*/
template<classKey,classValue>
intHashDictionary<Key,Value>::size()const
{
return valueCount;
}
// Place your implementations of the class methods probe(), has
h(),
// insert() and find() here
/** overload indexing operator[]
* Overload indexing operator[] to provide direct access
* to hash table. This is not normally part of the Dictionary
* API/abstraction, but included here for testing.
*
* @param index An integer index. The index should be in the r
ange 0 - tablesize-1.
*
* @returns KeyValuePair<> Returns a KeyValuePair object if t
he index into the
* internal hash table is a valid index. This method throws an
exception if
* the index is not a valid slot of the hash table.
*/
27. template<classKey,classValue>
KeyValuePair<Key,Value>&HashDictionary<Key,Value>::oper
ator[](int index)
{
if(index <0|| index >= tableSize)
{
cout <<"Error: <HashDictionary::operator[] invalid index: "
<< index <<" table size is currently: "
<< tableSize << endl;
assert(false);
}
return hashTable[index];
}
/** HashDictionary output stream operator
* Friend function for HashDictionary. We normally wouldn't h
ave
* something like this for a Dictionary or HashTable, but for tes
ting
* and learning purposes, we want to be able to display the cont
ents of
* each slot in the hash table of a HashDictionary container.
*
* @param out An output stream reference into which we should
insert
* a representation of the given HashDictionary.
* @param aDict A HashDictionary object that we want to displ
ay/represent
* on an output stream.
*
* @returns ostream& Returns a reference to the original given
output stream,
* but now the values representing the dictionary we were give
n should
28. * have been sent into the output stream.
*/
template<typename K,typename V>
ostream&operator<<(ostream& out,constHashDictionary<K, V>
& aDict)
{
for(int slot =0; slot < aDict.tableSize; slot++)
{
out <<"Slot: "<< slot << endl;
out <<" Key : "<< aDict.hashTable[slot].key()<< endl;
out <<" Value: "<< aDict.hashTable[slot].value()<< endl;
}
out << endl;
return out;
}
Assignment 13/HashDictionary.hpp
/**
* @author Jane Programmer
* @cwid 123 45 678
* @class COSC 2336, Spring 2019
* @ide Visual Studio Community 2017
* @date April 8, 2019
* @assg Assignment 13
*
* @description Template class for definining a dictionary
* that uses a hash table of KeyValuePair items.
* Based on Shaffer hashdict implementation pg. 340
*/
#include <cassert>
#include <iostream>
#include "KeyValuePair.hpp"
using namespace std;
29. #ifndef HASHDICTIONARY_HPP
#define HASHDICTIONARY_HPP
/** HashDictionary
* An implementation of a dictionary that uses a hash table to
insert, search
* and delete a set of KeyValuePair items. In the assignment,
we will be
* implementing a closed hashing table with quadratic probing.
The hash function
* will implement a version of the mid-square hasing function
described in
* our Shaffer textbook.
*
* @value hashTable An array of KeyValuePair items, the hash
table this class/container
* is managing.
* @value tableSize The actual size of the hashTable array
* @value valueCount The number of KeyValuePair items that
are currently being
* managed and are contained in the hashTable
* @value EMPTYKEY A special user-supplied key that can be
used to indicate empty
* slots. Since how we determine what is a valid/invalid key
will depend on the
* key type, the user must supply this special flag/value when
setting up the
* hash dictionary.
*/
template <class Key, class Value>
class HashDictionary
{
protected:
KeyValuePair<Key, Value>* hashTable; // the hash table
30. int tableSize; // the size of the hash table, e.g. symbol M from
textbook
int valueCount; // the count of the number of value items
currently in table
Key EMPTYKEY; // a special user-supplied key that can be
used to indicate empty slots
public:
// constructors and destructors
HashDictionary(int tableSize, Key emptyKey);
~HashDictionary();
// accessor methods
int size() const;
// searching and insertion
// all 4 of the methods you were required to create for this
// assignment should have appropriate class method signatures
// defined here.
// overload operators (mostly for testing)
KeyValuePair<Key, Value>& operator[](int index);
template <typename K, typename V>
friend ostream& operator<<(ostream& out, const
HashDictionary<K, V>& aDict);
};
#include "HashDictionary.cpp"
#endif // HASHDICTIONARY_HPP
Assignment 13/Instructions.png
Assignment 13/KeyValuePair.cppAssignment
31. 13/KeyValuePair.cpp/**
* @author Jane Programmer
* @cwid 123 45 678
* @class COSC 2336, Spring 2019
* @ide Visual Studio Community 2017
* @date April 8, 2019
* @assg Assignment 13
*
* @description Template class for definining Key/Value pairs,
* suitable for dictionary and hash table implementations.
* Based on Shaffer KVPair ADT definition, pg. 139 Fig 4.31.
*/
/** constructor
* Default constructor for a KeyValuePair.
*/
template<classKey,classValue>
KeyValuePair<Key,Value>::KeyValuePair()
{
}
/** constructor
* Standard constructor for a KeyValuePair.
*
* @param key The key portion that is to be stored in this pair.
* @param value The value portion that is to be stored in this pa
ir.
*/
template<classKey,classValue>
KeyValuePair<Key,Value>::KeyValuePair(Key key,Valuevalue)
{
this->myKey = key;
this->myValue =value;
32. }
/** key accessor
* Accessor method to get and return the key for this key/value
pair
*
* @returns Key Returns an object of template type Key, which
is the
* key portion of the pair in this container.
*/
template<classKey,classValue>
KeyKeyValuePair<Key,Value>::key()
{
return myKey;
}
/** key setter
* Accessor method to set the key for this key/value pair
*
* @param key The new value to update the key to for this pair.
*/
template<classKey,classValue>
voidKeyValuePair<Key,Value>::setKey(Key key)
{
this->myKey = key;
}
/** value accessor
* Accessor method to get and return the value for this key/valu
e pair.
*
* @returns Value& Returns a reference to the value object in th
is
33. * key value pair container.
*/
template<classKey,classValue>
Value&KeyValuePair<Key,Value>::value()
{
return myValue;
}
Assignment 13/KeyValuePair.hpp
/**
* @author Jane Programmer
* @cwid 123 45 678
* @class COSC 2336, Spring 2019
* @ide Visual Studio Community 2017
* @date April 8, 2019
* @assg Assignment 13
*
* @description Template class for definining Key/Value pairs,
* suitable for dictionary and hash table implementations.
* Based on Shaffer KVPair ADT definition, pg. 139 Fig 4.31.
*/
#ifndef KEYVALUEPAIR_HPP
#define KEYVALUEPAIR_HPP
/** KeyValue Pair
* Definition of basic key/value pair container. This container
of course
* associates a value (usually a record like a class or struct),
with
* a key (can be anything).
*
34. * We do not use the comparator Strategy pattern as discussed
in
* Shaffer pg. 144 here. We assume that the Key type has
suitably
* overloaded operators for <, >, ==, <=, >= operations as
needed
* in order to compare and order keys if needed by dictionaries
and
* hash tables using a KeyValuePair.
*
* @value key The key for a key/value pair item/association.
* @value value The value for a key/value pair, usually
something like
* a record (a class or struct of data we are hashing or keeping
in
* a dictionary).
*/
template <class Key, class Value>
class KeyValuePair
{
private:
Key myKey;
Value myValue;
public:
// constructors
KeyValuePair();
KeyValuePair(Key key, Value value);
// accessors, getters and setters
Key key();
void setKey(Key key);
Value& value();
};