Data structuresUsing java language and develop a prot.pdfarmyshoes
Data structures:
****Using java language and develop a prototype for a demo program that reads in strings that
look like:
Using the infix to postfix code below:
A = 3; // your code should store A and 3 as a key-value pair
B = 4; // your code should store B and 4 as a key-value pair
A; // your code should now look-up A and then display its value
later we (you) will add the ability to write
Y = A * B + 3;
Y; // your code should show 16
Using this code
// infix.java
// converts infix arithmetic expressions to postfix
// to run this program: C>java InfixApp
import java.io.*; // for I/O
////////////////////////////////////////////////////////////////
class StackX {
private int maxSize;
private char[] stackArray;
private int top;
// --------------------------------------------------------------
public StackX(int s) // constructor
{
maxSize = s;
stackArray = new char[maxSize];
top = -1;
}
// --------------------------------------------------------------
public void push(char j) // put item on top of stack
{
stackArray[++top] = j;
}
// --------------------------------------------------------------
public char pop() // take item from top of stack
{
return stackArray[top--];
}
// --------------------------------------------------------------
public char peek() // peek at top of stack
{
return stackArray[top];
}
// --------------------------------------------------------------
public boolean isEmpty() // true if stack is empty
{
return (top == -1);
}
// -------------------------------------------------------------
public int size() // return size
{
return top + 1;
}
// --------------------------------------------------------------
public char peekN(int n) // return item at index n
{
return stackArray[n];
}
// --------------------------------------------------------------
public void displayStack(String s) {
System.out.print(s);
System.out.print(\"Stack (bottom-->top): \");
for (int j = 0; j < size(); j++) {
System.out.print(peekN(j));
System.out.print(\' \');
}
System.out.println(\" \");
}
// --------------------------------------------------------------
} // end class StackX
////////////////////////////////////////////////////////////////
class InToPost // infix to postfix conversion
{
private StackX theStack;
private String input;
private String output = \"\";
// --------------------------------------------------------------
public InToPost(String in) // constructor
{
input = in;
int stackSize = input.length();
theStack = new StackX(stackSize);
}
// --------------------------------------------------------------
public String doTrans() // do translation to postfix
{
for (int j = 0; j < input.length(); j++) {
char ch = input.charAt(j);
theStack.displayStack(\"For \" + ch + \" \"); // *diagnostic*
switch (ch) {
case \'+\': // it’s + or -
case \'-\':
gotOper(ch, 1); // go pop operators
break; // (precedence 1)
case \'*\': // it’s * or /
case \'/\':
gotOper(ch, 2); // go pop operators
break; // (precedence 2)
case \'(\': // it’s a left paren
theStack.push(.
Using C++I keep getting messagehead does not name a type.pdfalokkesh1
Using C++
I keep getting message:
\'head does not name a type\'
\'teal does not name a type\'
Where do I place this code in my program:
/*search and delete with respect to location as current, head and tail
//define below 2 lines in LinkedList() function
head = new NodeType;
tail = new NodeType;
void UnsorderedType::DeleteItem(ItemType item)
{
NodeType *tempLocation, *location;
bool stop = false;
if(!isEmpty())
{
location = head;
tempLocation = head->link;
while (templocation != tail && !stop)
{
if (templocation->info == item)
stop = true;
else
{
location = templocation;
templocation = templocation->link;
}
}
if (!stop)
cout << \"The node to delete is not in the list!\" << endl;
else
{
location->link = templocation->link;
delete templocation;
count--;
}
}
else
{
cout << \"The list is empty!\" << endl;
}
}*/
/Problem and code:
Implement the UnsortedList class to store a list of strings that are input into the list from
data2.txt.
- create a main.cpp file that gets the numbers from the file
- insert the word \"cat\" into the list
- insert another word \"antibacterial\" into the list
- delete the word \"letter\" from the list
- print out the following:
--the entire list
- the greatest
- the least
2. Attach the main.cpp, UnsortedList.cpp, the ItemType.h, and the output file one called
outfile1.txt
- Yes you need to make your program output an \"outfile1.txt\"
3. Implement the UnsortedList class to store a list of numbers that are input into the list from
data.txt.
- create a main.cpp file that gets the numbers from the file
- insert the number 7 into the list
- insert another number 300 into the list
- delete the number 6 from the list
- print out the following:
--the entire list
- the greatest
- the least
2. Attach the main.cpp, UnsortedList.cpp, the ItemType.h, and the output file two called
outfile2.txt
- Yes you need to make your program output an \"outfile2.txt\"
data.txt
super formula travel free thick Josephine Clara education
data2.txt
super formula travel free thick Josephine Clara education
//My main.cpp
//--------------------------------------------------------------
// Test driver for Linked List UnsortedType list
// Navarr Barnier
// Your class CS3350 TTh 1:00
// Due date: Thursday, September 13, 2012
//
// Compile command: g++ hw2.cpp ch03-UnsortedType.cpp ch03-ItemType.cpp
// Input file name: hw2.txt
// Contains list of commands to add items to list, split original
// list into two lists, print each list and get the length of
// each list.
// Output: The result of each command is displayed on the screen.
// Filename: hw2.cpp
//--------------------------------------------------------------
#include
#include
#include
#include
#include
#include \"ItemType.h\"
using namespace std;
void PrintList(UnsortedType&);
void SplitList(UnsortedType&, ItemType);
ItemType GetItem(ItemType& item, bool& found);
int main()
{
ifstream inFile; // file containing operations
ofstream outFS; // Output file stream
string data; // operation to be executed
s.
Complete the C++ program and implement the routines that are n.docxShiraPrater50
Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx
Data structuresUsing java language and develop a prot.pdfarmyshoes
Data structures:
****Using java language and develop a prototype for a demo program that reads in strings that
look like:
Using the infix to postfix code below:
A = 3; // your code should store A and 3 as a key-value pair
B = 4; // your code should store B and 4 as a key-value pair
A; // your code should now look-up A and then display its value
later we (you) will add the ability to write
Y = A * B + 3;
Y; // your code should show 16
Using this code
// infix.java
// converts infix arithmetic expressions to postfix
// to run this program: C>java InfixApp
import java.io.*; // for I/O
////////////////////////////////////////////////////////////////
class StackX {
private int maxSize;
private char[] stackArray;
private int top;
// --------------------------------------------------------------
public StackX(int s) // constructor
{
maxSize = s;
stackArray = new char[maxSize];
top = -1;
}
// --------------------------------------------------------------
public void push(char j) // put item on top of stack
{
stackArray[++top] = j;
}
// --------------------------------------------------------------
public char pop() // take item from top of stack
{
return stackArray[top--];
}
// --------------------------------------------------------------
public char peek() // peek at top of stack
{
return stackArray[top];
}
// --------------------------------------------------------------
public boolean isEmpty() // true if stack is empty
{
return (top == -1);
}
// -------------------------------------------------------------
public int size() // return size
{
return top + 1;
}
// --------------------------------------------------------------
public char peekN(int n) // return item at index n
{
return stackArray[n];
}
// --------------------------------------------------------------
public void displayStack(String s) {
System.out.print(s);
System.out.print(\"Stack (bottom-->top): \");
for (int j = 0; j < size(); j++) {
System.out.print(peekN(j));
System.out.print(\' \');
}
System.out.println(\" \");
}
// --------------------------------------------------------------
} // end class StackX
////////////////////////////////////////////////////////////////
class InToPost // infix to postfix conversion
{
private StackX theStack;
private String input;
private String output = \"\";
// --------------------------------------------------------------
public InToPost(String in) // constructor
{
input = in;
int stackSize = input.length();
theStack = new StackX(stackSize);
}
// --------------------------------------------------------------
public String doTrans() // do translation to postfix
{
for (int j = 0; j < input.length(); j++) {
char ch = input.charAt(j);
theStack.displayStack(\"For \" + ch + \" \"); // *diagnostic*
switch (ch) {
case \'+\': // it’s + or -
case \'-\':
gotOper(ch, 1); // go pop operators
break; // (precedence 1)
case \'*\': // it’s * or /
case \'/\':
gotOper(ch, 2); // go pop operators
break; // (precedence 2)
case \'(\': // it’s a left paren
theStack.push(.
Using C++I keep getting messagehead does not name a type.pdfalokkesh1
Using C++
I keep getting message:
\'head does not name a type\'
\'teal does not name a type\'
Where do I place this code in my program:
/*search and delete with respect to location as current, head and tail
//define below 2 lines in LinkedList() function
head = new NodeType;
tail = new NodeType;
void UnsorderedType::DeleteItem(ItemType item)
{
NodeType *tempLocation, *location;
bool stop = false;
if(!isEmpty())
{
location = head;
tempLocation = head->link;
while (templocation != tail && !stop)
{
if (templocation->info == item)
stop = true;
else
{
location = templocation;
templocation = templocation->link;
}
}
if (!stop)
cout << \"The node to delete is not in the list!\" << endl;
else
{
location->link = templocation->link;
delete templocation;
count--;
}
}
else
{
cout << \"The list is empty!\" << endl;
}
}*/
/Problem and code:
Implement the UnsortedList class to store a list of strings that are input into the list from
data2.txt.
- create a main.cpp file that gets the numbers from the file
- insert the word \"cat\" into the list
- insert another word \"antibacterial\" into the list
- delete the word \"letter\" from the list
- print out the following:
--the entire list
- the greatest
- the least
2. Attach the main.cpp, UnsortedList.cpp, the ItemType.h, and the output file one called
outfile1.txt
- Yes you need to make your program output an \"outfile1.txt\"
3. Implement the UnsortedList class to store a list of numbers that are input into the list from
data.txt.
- create a main.cpp file that gets the numbers from the file
- insert the number 7 into the list
- insert another number 300 into the list
- delete the number 6 from the list
- print out the following:
--the entire list
- the greatest
- the least
2. Attach the main.cpp, UnsortedList.cpp, the ItemType.h, and the output file two called
outfile2.txt
- Yes you need to make your program output an \"outfile2.txt\"
data.txt
super formula travel free thick Josephine Clara education
data2.txt
super formula travel free thick Josephine Clara education
//My main.cpp
//--------------------------------------------------------------
// Test driver for Linked List UnsortedType list
// Navarr Barnier
// Your class CS3350 TTh 1:00
// Due date: Thursday, September 13, 2012
//
// Compile command: g++ hw2.cpp ch03-UnsortedType.cpp ch03-ItemType.cpp
// Input file name: hw2.txt
// Contains list of commands to add items to list, split original
// list into two lists, print each list and get the length of
// each list.
// Output: The result of each command is displayed on the screen.
// Filename: hw2.cpp
//--------------------------------------------------------------
#include
#include
#include
#include
#include
#include \"ItemType.h\"
using namespace std;
void PrintList(UnsortedType&);
void SplitList(UnsortedType&, ItemType);
ItemType GetItem(ItemType& item, bool& found);
int main()
{
ifstream inFile; // file containing operations
ofstream outFS; // Output file stream
string data; // operation to be executed
s.
Complete the C++ program and implement the routines that are n.docxShiraPrater50
Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docxShiraPrater50
Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx
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;
}
/**
...
6Modify the bfs.java program (Listing A) to find the minimu.docxevonnehoggarth79783
6
Modify the bfs.java program (Listing A) to find the minimum spanning tree using a breadth-first search, rather than the depth-first search shown in
mst.java (Listing B). In main(), create a graph with 9 vertices and 12 edges,
and find its minimum spanning tree.
Listing A: The bfs.java Program
// bfs.java
// demonstrates breadth-first search
// to run this program: C>java BFSApp
////////////////////////////////////////////////////////////////
class Queue
{
private final int SIZE = 20;
private int[] queArray;
private int front;
private int rear;
// -------------------------------------------------------------
public Queue() // constructor
{
queArray = new int[SIZE];
front = 0;
rear = -1;
}
// -------------------------------------------------------------
public void insert(int j) // put item at rear of queue
{
if(rear == SIZE-1)
rear = -1;
queArray[++rear] = j;
}
// -------------------------------------------------------------
public int remove() // take item from front of queue
{
int temp = queArray[front++];
if(front == SIZE)
front = 0;
return temp;
}
// -------------------------------------------------------------
public boolean isEmpty() // true if queue is empty
{
return ( rear+1==front || (front+SIZE-1==rear) );
}
// -------------------------------------------------------------
} // end class Queue
////////////////////////////////////////////////////////////////
class Vertex
{
public char label; // label (e.g. ‘A’)
public boolean wasVisited;
// -------------------------------------------------------------
public Vertex(char lab) // constructor
{
label = lab;
wasVisited = false;
}
// -------------------------------------------------------------
} // end class Vertex
////////////////////////////////////////////////////////////////
class Graph
{
private final int MAX_VERTS = 20;
private Vertex vertexList[]; // list of vertices
private int adjMat[][]; // adjacency matrix
private int nVerts; // current number of vertices
private Queue theQueue;
// ------------------
public Graph() // constructor
{
vertexList = new Vertex[MAX_VERTS];
// adjacency matrix
adjMat = new int[MAX_VERTS][MAX_VERTS];
nVerts = 0;
for(int j=0; j<MAX_VERTS; j++) // set adjacency
for(int k=0; k<MAX_VERTS; k++) // matrix to 0
adjMat[j][k] = 0;
theQueue = new Queue();
} // end constructor
// -------------------------------------------------------------
public void addVertex(char lab)
{
vertexList[nVerts++] = new Vertex(lab);
}
// -------------------------------------------------------------
public void addEdge(int start, int end)
{
adjMat[start][end] = 1;
adjMat[end][start] = 1;
}
// -------------------------------------------------------------
public void displayVertex(int v)
{
System.out.print(vertexList[v].label);
}
// -------------------------------------------------------------
public void bfs() // breadth-first search
{ // begin at vertex 0
vertexList[0].wasVisited = true; // mark it
displayVertex(0); // display it
theQueue.insert(0); // insert at tail
int v2;.
Start with the inclusion of libraries#include iostream .docxMARRY7
// Start with the inclusion of libraries
#include <iostream> //The library of io functions
#include <fstream> //The library of external stream functions
#include <cstdlib> //The library for external errors
#include <string> //The library for string functions
#include <cmath> //The library of C math functions
#include <iomanip> //Allows setting widths, etc. for I/O
#include <stdlib.h>
#include <stdio.h>
#include<vector>
using namespace std;
// Define all of the prototypes for functions used in the program
// Counts the number of unique letters seen
int countunique(int *array, int size);
// Creates the input file and formats it for use by the cipher section.
void createinput(string ifile, string ofile);
// Creates the encoded input file
void createcipher(int key, string ifile, string ofile);
// Finds and counts the number of digrams
int digram(int *pointer, string ifile);
// Counts the letter frequency in the encoded input file
int lettercount(int*, string ifile, string ofile);
// Finds the highest count in the singlton (or any other) array
int singleton(int*, int size);
// Trims an input file to the right size starting at an offset
void trimfile(string ifile, string ofile, int offset, int size);
// Begin the main function for testing
int main(int argc, char* argv[])
{
int count = 0;
int second = 0;
int singlefreq[26];
int *single = singlefreq;
int delta;
int loop; //The loop counter for arguments
int final = 0;
int totalcnt;
int key = -1; //Sets the key value
int len = 0; //The length to investigate for testing
int off; //Holds the offset into the file
double m; //Holds the metric error value
char loopletter;
float percent;
string ifile1 = "";
string ofile1 = "";
string deflt = "c:\\dissertation\\ShiftandSubcipherC++files\\clean.txt";
string ifile2 = "";
string ofile2 = ""; //Holds selected file path names
string cmdarg; //Holds the command line argument
string stop = "l"; //Gives the stop condition, assumes l
string reportfile = "c:\\dissertation\\test\\report.txt";
ofstream outs; //Declare an output stream for reporting
int digramc[676]; //Set up the digram array
int *two = digramc; //Point to the digram array
int dicount = 0; //Holds the count of the number of digrams
int total = 0; //Counts the total number of letters seen for analysis
for (loop = 1; loop<argc; loop++) //Decide if we have arguments or must use defaults
{
if (!argv[1])
{
// cout << "No argument found.\n";
ifile1 = deflt;
}
else
{
cmdarg = argv[loop];
if (cmdarg == "-k")
{
loop++;
key = atoi(argv[loop]);
cout << "key = " << key << endl;
}
if (cmdarg == "-l")
{
loop++;
len = atoi(argv[loop]);
cout << "Run for " << len << " characters.\n";
}
if (cmdarg == "-m")
{
loop++;
m = atof(argv[loop]);
cout << "Run until and error of " << m << "\n";
}
if (cmdarg == "-off")
{
loop++;
off = atoi(argv[loop]);
cout << ...
I need help with implementing the priority queue data structure with a.docxhendriciraida
I need help with implementing the priority queue data structure with a linked list implementation and with modifying my code with a template. Make sure that the code has the required methods to get the given test code in driver.cpp to work properly. I will provide the main cpp file and what I have so far below. The code is in C++. Add comments to where you modified the code, so I know what you did to change it. Thank you.
//////////////////////// driver.cpp /////////////////////////////
#include <iostream>
#include <string>
#include "stackLL.h"
#include "queueLL.h"
#include "priorityQueueLL.h"
using namespace std;
int main()
{
/////////////Test code for stack ///////////////
stackLL stk;
stk.push(5);
stk.push(13);
stk.push(7);
stk.push(3);
stk.push(2);
stk.push(11);
cout << "Popping: " << stk.pop() << endl;
cout << "Popping: " << stk.pop() << endl;
stk.push(17);
stk.push(19);
stk.push(23);
while (!stk.empty())
{
cout << "Popping: " << stk.pop() << endl;
}
// output order: 11,2,23,19,17,3,7,13,5
stackLL stkx;
stkx.push(5);
stkx.push(10);
stkx.push(15);
stkx.push(20);
stkx.push(25);
stkx.push(30);
stkx.insertAt(-100, 3);
stkx.insertAt(-200, 7);
stkx.insertAt(-300, 0);
//output order: -300,30,25,20,-100,15,10,5,-200
while (!stkx.empty())
cout << "Popping: " << stkx.pop() << endl;
///////////////////////////////////////
//////////Test code for queue ///////////
queueLL Q;
Q.enqueue(1);
Q.enqueue(2);
Q.enqueue(3);
cout << "Dequeuing: " << Q.dequeue() << endl; //1
cout << "Dequeuing: " << Q.dequeue() << endl; //2
Q.enqueue(4);
Q.enqueue(5);
//3 4 5
while (!Q.empty())
{
cout << "Dequeuing: " << Q.dequeue() << endl;
}
/////////////////////////////////////////
//////////Test code for priority queue/////
priorityQueueLL<int> pQueue;
const int SIZE = 20;
//insert a bunch of random numbers
for (int i = 0; i < SIZE; i++)
{
pQueue.insert(rand());
}
//pull them back out..
//They must come out in order from smallest to largest
while (!pQueue.empty())
{
cout << pQueue.extractMin() << endl;
}
priorityQueueLL<string> pqs;
pqs.insert("whale");
pqs.insert("snake");
pqs.insert("buffalo");
pqs.insert("elmo");
pqs.insert("fire");
pqs.insert("waffle");
//buffalo elmo fire snake waffle whale
while (!pqs.empty())
{
cout << pqs.extractMin() << endl;
}
///////////////////////////////////////////
//1) Template your queue class
//2) Add a decimate method to your queue class
queueLL<int> qx;
for (int i = 1; i <= 100; i++)
qx.enqueue(i);
//Eliminate every 10th item from list
//https://en.wikipedia.org/wiki/Decimation_(punishment)
qx.decimate();
//1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 21 22... 98 99
while (!qx.empty())
cout << qx.dequeue() << endl;
queueLL<string> qy;
qy.enqueue("sparticus");
qy.enqueue("maximus");
qy.enqueue("killicus");
qy.enqueue("awesomeicus");
qy.enqueue("gannicus");
qy.enqueue("varro");
qy.enqueue("oenomous");
qy.enqueue("slayicus");
qy.enqueue("bladeicus");
qy.enqueue("ted.
Can you finish and write the int main for the code according to the in.pdfaksachdevahosymills
Can you finish and write the int main for the code according to the instruction Thank you so
much.
Here's the code for the BSTNode ADT and BST implementation:
#include <iostream>
#include <fstream>
#include <queue>
using namespace std;
// Krone class
class Krone {
private:
int wholeValue;
int fractionalValue;
public:
Krone() {}
Krone(int whole, int fraction) : wholeValue(whole), fractionalValue(fraction) {}
int getWhole() const { return wholeValue; }
int getFraction() const { return fractionalValue; }
bool operator<(const Krone& other) const {
if (wholeValue < other.wholeValue) {
return true;
} else if (wholeValue == other.wholeValue) {
return fractionalValue < other.fractionalValue;
} else {
return false;
}
}
friend ostream& operator<<(ostream& out, const Krone& krone) {
out << "Kr " << krone.wholeValue << "." << krone.fractionalValue;
return out;
}
};
// BST Node class
class BSTNode {
private:
Krone data;
BSTNode* left;
BSTNode* right;
public:
BSTNode() {}
BSTNode(const Krone& krone) : data(krone), left(nullptr), right(nullptr) {}
Krone getData() const { return data; }
BSTNode* getLeft() const { return left; }
BSTNode* getRight() const { return right; }
void setData(const Krone& krone) { data = krone; }
void setLeft(BSTNode* node) { left = node; }
void setRight(BSTNode* node) { right = node; }
};
// BST class
class BST {
private:
BSTNode* root;
public:
BST() : root(nullptr) {}
BSTNode* getRoot() const { return root; }
bool isEmpty() const { return root == nullptr; }
int countNodes(BSTNode* node) const {
if (node == nullptr) {
return 0;
} else {
return 1 + countNodes(node->getLeft()) + countNodes(node->getRight());
}
}
void empty(BSTNode* node) {
if (node != nullptr) {
empty(node->getLeft());
empty(node->getRight());
delete node;
}
}
void insertNode(const Krone& krone) {
BSTNode* node = new BSTNode(krone);
if (isEmpty()) {
root = node;
} else {
BSTNode* currNode = root;
while (true) {
if (krone < currNode->getData()) {
if (currNode->getLeft() == nullptr) {
currNode->setLeft(node);
break;
} else {
currNode = currNode->getLeft();
}
} else {
if (currNode->getRight() == nullptr) {
currNode->setRight(node);
break;
} else {
currNode = currNode->getRight();
}
}
}
}
}
BSTNode* searchNode(const Krone& krone) const {
BSTNode* currNode = root;
while (currNode != nullptr) {
Declare and implement a BSTNode ADT with a data attribute and two pointer attributes, one for
the left child and the other for the right child. Implement the usual getters/setters for these
attributes.
Declare and implement a BST as a link-based ADT whose data will be Krone objects - the data
will be inserted based on the actual money value of your Krone objects as a combination of the
whole value and fractional value attributes.
For the BST, implement the four traversal methods as well as methods for the usual search,
insert, delete, print, count, isEmpty, empty operations and any other needed.
Your pgm will use the following 20 Krone objects to be created in the exact order in your.
#include
#include
#include
#include
using namespace std;
struct city
{
string name; // name of the city
city *next; // pointer to the next city
int numberMessages; // how many messages passed through this city
string message; // message we are sending accross
};
city* addCity(city *head, city *previous, string cityName );
city* deleteCity(city *head, string cityName);
city* deleteEntireNetwork(city *head);
city* searchNetwork(city *head, string cityName);
city* loadDefaultSetup(city *head);
void transmitMsg(city *head, string receiver, string filename);
void printPath(city *head);
void displayMenu();
city* handleUserInput(city *head);
/* Do NOT modify main function */
int main(int argc, char* argv[])
{
// pointer to the head of our network of cities
city *head = NULL;
head = handleUserInput(head);
printPath(head);
head = deleteEntireNetwork(head);
if (head == NULL)
cout << \"Path cleaned\" << endl;
else
printPath(head);
cout << \"Goodbye!\" << endl;
return 0;
}
/*
* Purpose: handle the interaction with the user
* Do NOT modify
*/
city* handleUserInput(city *head)
{
bool quit = false;
string s_input;
int input;
// loop until the user quits
while (!quit)
{
displayMenu();
// read in input, assuming a number comes in
getline(cin, s_input);
input = stoi(s_input);
switch (input)
{
// print all nodes
case 1: //rebuild network
head = loadDefaultSetup(head);
printPath(head);
break;
case 2: // print path
printPath(head);
break;
case 3: //message is read in from file
{
string cityReceiver;
cout << \"Enter name of the city to receive the message: \" << endl;
getline(cin, cityReceiver);
cout << \"Enter the message to send: \" << endl;
string message;
getline(cin, message);
transmitMsg(head, cityReceiver, message);
}
break;
case 4:
{
string newCityName;
string prevCityName;
cout << \"Enter a new city name: \" << endl;
getline(cin, newCityName);
cout << \"Enter the previous city name (or First): \" << endl;
getline(cin, prevCityName);
// find the node containing prevCity
city *tmp = NULL;
if(prevCityName !=\"First\")
tmp = searchNetwork(head, prevCityName);
// add the new node
head = addCity(head, tmp, newCityName);
printPath(head);
}
break;
case 5: // delete city
{
string city;
cout << \"Enter a city name: \" << endl;
getline(cin, city);
head = deleteCity(head, city);
printPath(head);
}
break;
case 6: // delete network
head = deleteEntireNetwork(head);
break;
case 7: // quit
quit = true;
cout << \"Quitting... cleaning up path: \" << endl;
break;
default: // invalid input
cout << \"Invalid Input\" << endl;
break;
}
}
return head;
}
/*
* Purpose: Add a new city to the network
* between the city *previous and the city that follows it in the network.
*/
city* addCity(city *head, city *previous, string cityName )
{
city* add = new city; //to distinguish and create the new node, i named it add
add->name = cityName;
city* tmp = new city;
tmp=head;
if(previous == NULL){
add->next = head;
head = add;
}
while(tmp != NULL && previous != tmp){
tmp = tmp->next;
}
if(tm.
Complete C++ Program Pdf......As because this document does not contain any theory so kindly feel free to ask if have any doubt or problem.
Happy to help. Thanks
Complete the C++ program and implement the routines that are n.docxShiraPrater50
Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx Complete the C++ program and implement the routines that are n.docx
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;
}
/**
...
6Modify the bfs.java program (Listing A) to find the minimu.docxevonnehoggarth79783
6
Modify the bfs.java program (Listing A) to find the minimum spanning tree using a breadth-first search, rather than the depth-first search shown in
mst.java (Listing B). In main(), create a graph with 9 vertices and 12 edges,
and find its minimum spanning tree.
Listing A: The bfs.java Program
// bfs.java
// demonstrates breadth-first search
// to run this program: C>java BFSApp
////////////////////////////////////////////////////////////////
class Queue
{
private final int SIZE = 20;
private int[] queArray;
private int front;
private int rear;
// -------------------------------------------------------------
public Queue() // constructor
{
queArray = new int[SIZE];
front = 0;
rear = -1;
}
// -------------------------------------------------------------
public void insert(int j) // put item at rear of queue
{
if(rear == SIZE-1)
rear = -1;
queArray[++rear] = j;
}
// -------------------------------------------------------------
public int remove() // take item from front of queue
{
int temp = queArray[front++];
if(front == SIZE)
front = 0;
return temp;
}
// -------------------------------------------------------------
public boolean isEmpty() // true if queue is empty
{
return ( rear+1==front || (front+SIZE-1==rear) );
}
// -------------------------------------------------------------
} // end class Queue
////////////////////////////////////////////////////////////////
class Vertex
{
public char label; // label (e.g. ‘A’)
public boolean wasVisited;
// -------------------------------------------------------------
public Vertex(char lab) // constructor
{
label = lab;
wasVisited = false;
}
// -------------------------------------------------------------
} // end class Vertex
////////////////////////////////////////////////////////////////
class Graph
{
private final int MAX_VERTS = 20;
private Vertex vertexList[]; // list of vertices
private int adjMat[][]; // adjacency matrix
private int nVerts; // current number of vertices
private Queue theQueue;
// ------------------
public Graph() // constructor
{
vertexList = new Vertex[MAX_VERTS];
// adjacency matrix
adjMat = new int[MAX_VERTS][MAX_VERTS];
nVerts = 0;
for(int j=0; j<MAX_VERTS; j++) // set adjacency
for(int k=0; k<MAX_VERTS; k++) // matrix to 0
adjMat[j][k] = 0;
theQueue = new Queue();
} // end constructor
// -------------------------------------------------------------
public void addVertex(char lab)
{
vertexList[nVerts++] = new Vertex(lab);
}
// -------------------------------------------------------------
public void addEdge(int start, int end)
{
adjMat[start][end] = 1;
adjMat[end][start] = 1;
}
// -------------------------------------------------------------
public void displayVertex(int v)
{
System.out.print(vertexList[v].label);
}
// -------------------------------------------------------------
public void bfs() // breadth-first search
{ // begin at vertex 0
vertexList[0].wasVisited = true; // mark it
displayVertex(0); // display it
theQueue.insert(0); // insert at tail
int v2;.
Start with the inclusion of libraries#include iostream .docxMARRY7
// Start with the inclusion of libraries
#include <iostream> //The library of io functions
#include <fstream> //The library of external stream functions
#include <cstdlib> //The library for external errors
#include <string> //The library for string functions
#include <cmath> //The library of C math functions
#include <iomanip> //Allows setting widths, etc. for I/O
#include <stdlib.h>
#include <stdio.h>
#include<vector>
using namespace std;
// Define all of the prototypes for functions used in the program
// Counts the number of unique letters seen
int countunique(int *array, int size);
// Creates the input file and formats it for use by the cipher section.
void createinput(string ifile, string ofile);
// Creates the encoded input file
void createcipher(int key, string ifile, string ofile);
// Finds and counts the number of digrams
int digram(int *pointer, string ifile);
// Counts the letter frequency in the encoded input file
int lettercount(int*, string ifile, string ofile);
// Finds the highest count in the singlton (or any other) array
int singleton(int*, int size);
// Trims an input file to the right size starting at an offset
void trimfile(string ifile, string ofile, int offset, int size);
// Begin the main function for testing
int main(int argc, char* argv[])
{
int count = 0;
int second = 0;
int singlefreq[26];
int *single = singlefreq;
int delta;
int loop; //The loop counter for arguments
int final = 0;
int totalcnt;
int key = -1; //Sets the key value
int len = 0; //The length to investigate for testing
int off; //Holds the offset into the file
double m; //Holds the metric error value
char loopletter;
float percent;
string ifile1 = "";
string ofile1 = "";
string deflt = "c:\\dissertation\\ShiftandSubcipherC++files\\clean.txt";
string ifile2 = "";
string ofile2 = ""; //Holds selected file path names
string cmdarg; //Holds the command line argument
string stop = "l"; //Gives the stop condition, assumes l
string reportfile = "c:\\dissertation\\test\\report.txt";
ofstream outs; //Declare an output stream for reporting
int digramc[676]; //Set up the digram array
int *two = digramc; //Point to the digram array
int dicount = 0; //Holds the count of the number of digrams
int total = 0; //Counts the total number of letters seen for analysis
for (loop = 1; loop<argc; loop++) //Decide if we have arguments or must use defaults
{
if (!argv[1])
{
// cout << "No argument found.\n";
ifile1 = deflt;
}
else
{
cmdarg = argv[loop];
if (cmdarg == "-k")
{
loop++;
key = atoi(argv[loop]);
cout << "key = " << key << endl;
}
if (cmdarg == "-l")
{
loop++;
len = atoi(argv[loop]);
cout << "Run for " << len << " characters.\n";
}
if (cmdarg == "-m")
{
loop++;
m = atof(argv[loop]);
cout << "Run until and error of " << m << "\n";
}
if (cmdarg == "-off")
{
loop++;
off = atoi(argv[loop]);
cout << ...
I need help with implementing the priority queue data structure with a.docxhendriciraida
I need help with implementing the priority queue data structure with a linked list implementation and with modifying my code with a template. Make sure that the code has the required methods to get the given test code in driver.cpp to work properly. I will provide the main cpp file and what I have so far below. The code is in C++. Add comments to where you modified the code, so I know what you did to change it. Thank you.
//////////////////////// driver.cpp /////////////////////////////
#include <iostream>
#include <string>
#include "stackLL.h"
#include "queueLL.h"
#include "priorityQueueLL.h"
using namespace std;
int main()
{
/////////////Test code for stack ///////////////
stackLL stk;
stk.push(5);
stk.push(13);
stk.push(7);
stk.push(3);
stk.push(2);
stk.push(11);
cout << "Popping: " << stk.pop() << endl;
cout << "Popping: " << stk.pop() << endl;
stk.push(17);
stk.push(19);
stk.push(23);
while (!stk.empty())
{
cout << "Popping: " << stk.pop() << endl;
}
// output order: 11,2,23,19,17,3,7,13,5
stackLL stkx;
stkx.push(5);
stkx.push(10);
stkx.push(15);
stkx.push(20);
stkx.push(25);
stkx.push(30);
stkx.insertAt(-100, 3);
stkx.insertAt(-200, 7);
stkx.insertAt(-300, 0);
//output order: -300,30,25,20,-100,15,10,5,-200
while (!stkx.empty())
cout << "Popping: " << stkx.pop() << endl;
///////////////////////////////////////
//////////Test code for queue ///////////
queueLL Q;
Q.enqueue(1);
Q.enqueue(2);
Q.enqueue(3);
cout << "Dequeuing: " << Q.dequeue() << endl; //1
cout << "Dequeuing: " << Q.dequeue() << endl; //2
Q.enqueue(4);
Q.enqueue(5);
//3 4 5
while (!Q.empty())
{
cout << "Dequeuing: " << Q.dequeue() << endl;
}
/////////////////////////////////////////
//////////Test code for priority queue/////
priorityQueueLL<int> pQueue;
const int SIZE = 20;
//insert a bunch of random numbers
for (int i = 0; i < SIZE; i++)
{
pQueue.insert(rand());
}
//pull them back out..
//They must come out in order from smallest to largest
while (!pQueue.empty())
{
cout << pQueue.extractMin() << endl;
}
priorityQueueLL<string> pqs;
pqs.insert("whale");
pqs.insert("snake");
pqs.insert("buffalo");
pqs.insert("elmo");
pqs.insert("fire");
pqs.insert("waffle");
//buffalo elmo fire snake waffle whale
while (!pqs.empty())
{
cout << pqs.extractMin() << endl;
}
///////////////////////////////////////////
//1) Template your queue class
//2) Add a decimate method to your queue class
queueLL<int> qx;
for (int i = 1; i <= 100; i++)
qx.enqueue(i);
//Eliminate every 10th item from list
//https://en.wikipedia.org/wiki/Decimation_(punishment)
qx.decimate();
//1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 21 22... 98 99
while (!qx.empty())
cout << qx.dequeue() << endl;
queueLL<string> qy;
qy.enqueue("sparticus");
qy.enqueue("maximus");
qy.enqueue("killicus");
qy.enqueue("awesomeicus");
qy.enqueue("gannicus");
qy.enqueue("varro");
qy.enqueue("oenomous");
qy.enqueue("slayicus");
qy.enqueue("bladeicus");
qy.enqueue("ted.
Can you finish and write the int main for the code according to the in.pdfaksachdevahosymills
Can you finish and write the int main for the code according to the instruction Thank you so
much.
Here's the code for the BSTNode ADT and BST implementation:
#include <iostream>
#include <fstream>
#include <queue>
using namespace std;
// Krone class
class Krone {
private:
int wholeValue;
int fractionalValue;
public:
Krone() {}
Krone(int whole, int fraction) : wholeValue(whole), fractionalValue(fraction) {}
int getWhole() const { return wholeValue; }
int getFraction() const { return fractionalValue; }
bool operator<(const Krone& other) const {
if (wholeValue < other.wholeValue) {
return true;
} else if (wholeValue == other.wholeValue) {
return fractionalValue < other.fractionalValue;
} else {
return false;
}
}
friend ostream& operator<<(ostream& out, const Krone& krone) {
out << "Kr " << krone.wholeValue << "." << krone.fractionalValue;
return out;
}
};
// BST Node class
class BSTNode {
private:
Krone data;
BSTNode* left;
BSTNode* right;
public:
BSTNode() {}
BSTNode(const Krone& krone) : data(krone), left(nullptr), right(nullptr) {}
Krone getData() const { return data; }
BSTNode* getLeft() const { return left; }
BSTNode* getRight() const { return right; }
void setData(const Krone& krone) { data = krone; }
void setLeft(BSTNode* node) { left = node; }
void setRight(BSTNode* node) { right = node; }
};
// BST class
class BST {
private:
BSTNode* root;
public:
BST() : root(nullptr) {}
BSTNode* getRoot() const { return root; }
bool isEmpty() const { return root == nullptr; }
int countNodes(BSTNode* node) const {
if (node == nullptr) {
return 0;
} else {
return 1 + countNodes(node->getLeft()) + countNodes(node->getRight());
}
}
void empty(BSTNode* node) {
if (node != nullptr) {
empty(node->getLeft());
empty(node->getRight());
delete node;
}
}
void insertNode(const Krone& krone) {
BSTNode* node = new BSTNode(krone);
if (isEmpty()) {
root = node;
} else {
BSTNode* currNode = root;
while (true) {
if (krone < currNode->getData()) {
if (currNode->getLeft() == nullptr) {
currNode->setLeft(node);
break;
} else {
currNode = currNode->getLeft();
}
} else {
if (currNode->getRight() == nullptr) {
currNode->setRight(node);
break;
} else {
currNode = currNode->getRight();
}
}
}
}
}
BSTNode* searchNode(const Krone& krone) const {
BSTNode* currNode = root;
while (currNode != nullptr) {
Declare and implement a BSTNode ADT with a data attribute and two pointer attributes, one for
the left child and the other for the right child. Implement the usual getters/setters for these
attributes.
Declare and implement a BST as a link-based ADT whose data will be Krone objects - the data
will be inserted based on the actual money value of your Krone objects as a combination of the
whole value and fractional value attributes.
For the BST, implement the four traversal methods as well as methods for the usual search,
insert, delete, print, count, isEmpty, empty operations and any other needed.
Your pgm will use the following 20 Krone objects to be created in the exact order in your.
#include
#include
#include
#include
using namespace std;
struct city
{
string name; // name of the city
city *next; // pointer to the next city
int numberMessages; // how many messages passed through this city
string message; // message we are sending accross
};
city* addCity(city *head, city *previous, string cityName );
city* deleteCity(city *head, string cityName);
city* deleteEntireNetwork(city *head);
city* searchNetwork(city *head, string cityName);
city* loadDefaultSetup(city *head);
void transmitMsg(city *head, string receiver, string filename);
void printPath(city *head);
void displayMenu();
city* handleUserInput(city *head);
/* Do NOT modify main function */
int main(int argc, char* argv[])
{
// pointer to the head of our network of cities
city *head = NULL;
head = handleUserInput(head);
printPath(head);
head = deleteEntireNetwork(head);
if (head == NULL)
cout << \"Path cleaned\" << endl;
else
printPath(head);
cout << \"Goodbye!\" << endl;
return 0;
}
/*
* Purpose: handle the interaction with the user
* Do NOT modify
*/
city* handleUserInput(city *head)
{
bool quit = false;
string s_input;
int input;
// loop until the user quits
while (!quit)
{
displayMenu();
// read in input, assuming a number comes in
getline(cin, s_input);
input = stoi(s_input);
switch (input)
{
// print all nodes
case 1: //rebuild network
head = loadDefaultSetup(head);
printPath(head);
break;
case 2: // print path
printPath(head);
break;
case 3: //message is read in from file
{
string cityReceiver;
cout << \"Enter name of the city to receive the message: \" << endl;
getline(cin, cityReceiver);
cout << \"Enter the message to send: \" << endl;
string message;
getline(cin, message);
transmitMsg(head, cityReceiver, message);
}
break;
case 4:
{
string newCityName;
string prevCityName;
cout << \"Enter a new city name: \" << endl;
getline(cin, newCityName);
cout << \"Enter the previous city name (or First): \" << endl;
getline(cin, prevCityName);
// find the node containing prevCity
city *tmp = NULL;
if(prevCityName !=\"First\")
tmp = searchNetwork(head, prevCityName);
// add the new node
head = addCity(head, tmp, newCityName);
printPath(head);
}
break;
case 5: // delete city
{
string city;
cout << \"Enter a city name: \" << endl;
getline(cin, city);
head = deleteCity(head, city);
printPath(head);
}
break;
case 6: // delete network
head = deleteEntireNetwork(head);
break;
case 7: // quit
quit = true;
cout << \"Quitting... cleaning up path: \" << endl;
break;
default: // invalid input
cout << \"Invalid Input\" << endl;
break;
}
}
return head;
}
/*
* Purpose: Add a new city to the network
* between the city *previous and the city that follows it in the network.
*/
city* addCity(city *head, city *previous, string cityName )
{
city* add = new city; //to distinguish and create the new node, i named it add
add->name = cityName;
city* tmp = new city;
tmp=head;
if(previous == NULL){
add->next = head;
head = add;
}
while(tmp != NULL && previous != tmp){
tmp = tmp->next;
}
if(tm.
Complete C++ Program Pdf......As because this document does not contain any theory so kindly feel free to ask if have any doubt or problem.
Happy to help. Thanks
This slide explains the conversion procedure from ER Diagram to Relational Schema.
1. Entity set to Relation
2. Relationship set to Relation
3. Attributes to Columns, Primary key, Foreign Keys
1. What is Entity Relationship Model
2. Entity and Entity Set
3. Relationship and Relationship Set
4. Attributes and it's kinds
5. Participation Constraints and Mapping Cardinality
6. Aggregation, Specialization, and Generalization
7. Some Sample ERD models
This note includes the followings:
- Database Create, Drop Operations
- Database Table Create, Drop Operations
- Database Table Alter Operation
- Data insertion
- Data deletion
- Existing data update
- Searching data from data table (showing all record, specific columns, specific rows, column aliasing, sorting data, limiting data, distinct data)
- Aggregate functions
- Group by clause
- Having clause
- Types of table joins
- Table aliasing, Inner Join, Left/Right Join, Self Join
- Subquery operation (scalar subquery, column subquery, row subquery, correlated subquery, derived table)
This note contains some sample MySQL query practices based on the HR Schema database. The practice sections are from the following categories:
- DDL statements
- Basic Select statements
- Aggregate operations
- Join operations
This lecture slide contains:
- Difference between FA, PDA and TM
- Formal definition of TM
- TM transition function and configuration
- Designing TM for different languages
- Simulating TM for different strings
This slide contains,
1) Some terminologies like yields, derives, word, derivation
2) Leftmost and Rightmost derivation
3) Ambiguity checking
4) Parse tree generation and ambiguity checking
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
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.
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.
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.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
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.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Digital Tools and AI for Teaching Learning and Research
DS & Algo 1 - C++ and STL Introduction
1. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
C++
▪ Bjarne Stroustrup (1979 - 1983, C with Classes)
▪ C++ literally means “increased C”
Structure #include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
Output int age=27;
cout<<"Output line 1"<<endl;
cout<<120<<" "<<3.1416<<" Age = "<<age<<endl;
Input int num;
double pointnum;
char ch;
cin>>num>>pointnum>>ch;
cout<<num<<" "<<pointnum<<" "<<ch<<endl;
File I/O #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
///writing to a file
ofstream myfile;
myfile.open("testfile.txt", ios::out | ios::app);
if(myfile.is_open()){
myfile<<"First line"<<endl;
myfile<<"Second line"<<endl;
myfile.close();
}
else{
cout<<"Unable to open file"<<endl;
}
///reading from a file
ifstream myfile1;
myfile1.open("testfile.txt", ios::in);
string line;
if(myfile1.is_open()){
while(!myfile1.eof()){
getline(myfile1, line);
cout<<line<<endl;
}
myfile1.close();
}
else{
cout<<"Unable to open file"<<endl;
}
return 0;
}
2. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
C++ : STL – Standard Template Library
The Standard Template Library (STL) is a set of C++ template classes to provide common programming data structures
and functions such as dynamic arrays (vector), queues (queue), stacks (stack), associative arrays (map), etc. It is a library
of container classes, algorithms, and iterators.
STL Containers – A container is a holder of object that stores a collection of other objects. It manages the storage space
for its elements and provides member functions to access them, either directly or through iterators.
Some of the major containers:
▪ Vector
▪ Stack
▪ Queue
▪ Map
1. Vector – It represents arrays that can change in size. It uses contiguous storage locations for their elements.
Internally, vectors use a dynamically allocated array to store their elements. This array may need to be reallocated in
order to grow in size when new elements are inserted, which implies allocating a new array and moving all elements
to it.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
///----------------------------------------------------------------------
int arr[]={1,2,3,4};
int arrlen = sizeof(arr)/sizeof(int);
///Constructing an empty vector
vector<int> v1;
///Constructing a vector from an array
vector<int> v2 (arr, arr+arrlen);
///Constructing a vector from other vector
vector<int> v3 (v1);
///----------------------------------------------------------------------
///Accessing vector elements using iterator (points to the vector elements)
cout<<"Showing vector 2 - using Iterator"<<endl;
for(vector<int>::iterator it=v2.begin();it!=v2.end();it++){
cout<<*it<<endl;
}
///or,
cout<<"Showing vector 2 - using Index"<<endl;
for(int ind=0;ind<v2.size();ind++){
cout<<v2[ind]<<endl;
}
///To check whether the vector is empty or not
cout<<"Vector 1 empty check: "<< v1.empty() <<endl;
///----------------------------------------------------------------------
3. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
///Insertion - add single new element at the end of the vector, after its current last
element
v1.push_back(100);
///Insertion - insert new elements (1 or more) before the element at the specified
position
vector<int>::iterator it=v1.begin();
v1.insert(it,v2.begin(),v2.begin()+3);
cout<<"Showing vector 1 - after insertion"<<endl;
for(int ind=0;ind<v1.size();ind++){
cout<<v1[ind]<<endl;
}
///----------------------------------------------------------------------
///Deletion - remove the last element from the vector
v2.pop_back();
cout<<"Showing vector 2 - after pop_back()"<<endl;
for(int ind=0;ind<v2.size();ind++){
cout<<v2[ind]<<endl;
}
///Deletion - remove a single or range of elements from the vector
v1.erase(v1.begin()+2); ///remove only the 3rd elements
cout<<"Showing vector 1 - after erase(v1.begin()+2)"<<endl;
for(int ind=0;ind<v1.size();ind++){
cout<<v1[ind]<<endl;
}
v2.erase(v2.begin(),v2.begin()+2); ///remove the first 2 elements
cout<<"Showing vector 2 - after erase(v2.begin(), v2.begin()+2)"<<endl;
for(int ind=0;ind<v2.size();ind++){
cout<<v2[ind]<<endl;
}
///----------------------------------------------------------------------
return 0;
}
2. Stack – A type of container that operates in a LIFO (Last-in First-out) context, where elements are inserted and
extracted only from one end of the container.
#include <iostream>
#include <stack>
using namespace std;
int main()
{
///--------------------------------------------------------
///constructing an empty stack
stack<int> stk;
4. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
///--------------------------------------------------------
///To check the current size of the stack
cout<<"Stack size: "<< stk.size() <<endl;
///To check whether the stack is empty or not
cout<<"Stack empty check: "<< stk.empty() <<endl;
///--------------------------------------------------------
///Insertion - to push an item in the stack
cout<<"Inserting 100 and then 200"<<endl;
stk.push(100);
stk.push(200);
///--------------------------------------------------------
///Access - to access the topmost element of the stack
cout<<"Top element: "<< stk.top() <<endl;
///--------------------------------------------------------
///Deletion - to pop an item from the stack top
stk.pop();
cout<<"After pop: "<< stk.top() <<endl;
///--------------------------------------------------------
return 0;
}
3. Queue – A type of container that operates in FIFO (first-in first-out) context, where elements are inserted into one
end of the container and extracted from the other.
#include <iostream>
#include <queue>
using namespace std;
int main()
{
///------------------------------------------------------------------
///constructing an empty queue
queue<int> q;
///------------------------------------------------------------------
///To check the current size of the queue
cout<<"Size of the queue: "<<q.size()<<endl;
///To check an empty queue
cout<<"Queue empty check: "<<q.empty()<<endl;
///------------------------------------------------------------------
///Insertion - push an element at the end of the queue
cout<<"Inserting 100 and then 200"<<endl;
q.push(100);
q.push(200);
5. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
///------------------------------------------------------------------
///Accessing the front (oldest) element of the queue
cout<<"Oldest element: "<<q.front()<<endl;
///------------------------------------------------------------------
///Deletion - pop the oldest element from the queue
q.pop();
cout<<"After pop: "<<q.front()<<endl;
///------------------------------------------------------------------
return 0;
}
4. Map – It is an associative container that stores elements formed by a combination of a key value and a mapped
value, following a specific order. In a map, the key values are generally used to sort and uniquely identify the
elements, while the mapped values store the content associated to this key.
#include <iostream>
#include <map>
using namespace std;
int main()
{
///---------------------------------------------------------------
///constructing an empty map
map<char,int> first;
///constructing a new map from other map
map<char,int> second (first.begin(),first.end());
map<char,int> third (second);
///---------------------------------------------------------------
///Insertion - if key exists then replaces the existing value otherwise insert a new
element with that key
cout<<"Inserting a=>100 and b=>20"<<endl;
first['a']=10;
first['b']=20;
first['a']=100; ///replace
///Accessing any map element
cout<<"Accessing key a: "<< first['a']<<endl;
///---------------------------------------------------------------
///To check the size of the map
cout<<"Map size: "<<first.size()<<endl;
///To check whether the map is empty
cout<<"Map empty check: "<<first.empty()<<endl;
///---------------------------------------------------------------
///Deletion - to delete a specific map element
first.erase('b');
6. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
cout<<"After deletion key b, map size: "<<first.size()<<endl;
///---------------------------------------------------------------
///Search - to search for a key presence, if not found then returns map.end()
map<char,int>::iterator it=first.find('a');
if(it!=first.end()) cout<<"key a exists"<<endl;
else cout<<"key a doesn't exist"<<endl;
///---------------------------------------------------------------
///Accessing all the elements of the map
map<char,int> newmap;
newmap['a']=100;
newmap['b']=200;
newmap['c']=300;
for(map<char,int>::iterator it=newmap.begin();it!=newmap.end();it++){
cout<<"Key: "<<it->first<< " => "<<it->second<<endl;
}
///---------------------------------------------------------------
return 0;
}
#include <string> – strings are objects that represent sequence of characters.
#include <iostream>
#include <string>
using namespace std;
int main()
{
///--------------------------------------------------------
///constructing strings
string s0;
string s1 ("Initial value");
///--------------------------------------------------------
///new string assignment
s0 = "new string";
///string concatenation
string s2=s0+s1;
///to append new string at the end
s2+=" appended portion.";
///equality/greater than/less than checking
string s3 = "abc";
string s4 = "def";
cout<<"abc == def "<< (s3==s4) <<endl;
cout<<"abc != def "<< (s3!=s4) <<endl;
cout<<"abc > def "<< (s3>s4) <<endl;
cout<<"abc >= def "<< (s3>=s4) <<endl;
7. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
cout<<"abc < def "<< (s3<s4) <<endl;
cout<<"abc <= def "<< (s3<=s4) <<endl;
///--------------------------------------------------------
///To check the size of the string
cout<<"String length: "<<s2.size()<<endl;
///To check whether the string is empty or not
cout<<"String empty check: "<<s2.empty()<<endl;
///--------------------------------------------------------
///taking input from command prompt
string input1, input2;
getline(cin, input2); ///full line input
cin>>input1; ///word input
///outputting a string
cout<<input1<<endl;
cout<<input2<<endl;
///--------------------------------------------------------
string s5="abcdefghijghij";
///accessing specific characters
cout<<s5[2]<<endl;
///extracting substrings
cout<<s5.substr(3)<<endl; ///starting position
cout<<s5.substr(3,5)<<endl; ///starting position, length
///finding substring, returns -1 if not found
int find_index = s5.find("mno");
if(find_index==-1) cout<<"Substring not found"<<endl;
else cout<<"Substring found"<<endl;
///similarly we can use replace(), insert() and erase()
///--------------------------------------------------------
return 0;
}
#include <algorithm> – It defines a collection of functions especially designed to be used on ranges of elements (STL
containers, array etc.)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
///function for descending order sort
bool sortfn(int val1, int val2){
if(val1>val2) return true;
else return false;
}
int main()
8. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
{
///------------------------------------------------------
vector<int> v;
v.push_back(100);
v.push_back(40);
v.push_back(150);
v.push_back(128);
vector<int> v1(v);
///to find out the minimum element
vector<int>::iterator minit=min_element(v.begin(), v.end());
cout<<*minit<<endl;
///to find out the maximum element
vector<int>::iterator maxit=max_element(v.begin(), v.end());
cout<<*maxit<<endl;
///To sort a vector
sort(v.begin(),v.end()); ///default: ascending order sort
cout<<"Output"<<endl;
for(int ind=0;ind<v.size();ind++){
cout<<v[ind]<<" ";
}
cout<<endl;
///To sort based on predefined rule
sort(v.begin(),v.end(),sortfn);
cout<<"Output"<<endl;
for(int ind=0;ind<v.size();ind++){
cout<<v[ind]<<" ";
}
cout<<endl;
///To reverse a vector
reverse(v1.begin(),v1.end());
cout<<"Output"<<endl;
for(int ind=0;ind<v1.size();ind++){
cout<<v1[ind]<<" ";
}
cout<<endl;
///Searching for an element
vector<int>::iterator find_ind=find(v1.begin(),v1.end(),180);
if(find_ind!=v1.end()) cout<<"Found"<<endl;
else cout<<"Not Found"<<endl;
///To count for number of occurrences
v1.push_back(99);
v1.push_back(99);
cout<<count(v1.begin(),v1.end(),99)<<endl;
return 0;
}
Reference Link: https://www.cplusplus.com/reference/