Complete the C++ program and implement the routines that are not .docxAbdulrahman890100
The document describes a C++ program that implements a binary tree data structure with various node-related methods like insertion, searching, and traversal. It includes class definitions for the tree nodes (TreeStruct), the overall tree (Tree), and auxiliary stack and queue classes. Many methods are only declared, leaving their implementation incomplete. The main() function tests the various methods by building a sample tree and printing outputs.
Complete the C++ program and implement the routines that are not .docxShiraPrater50
The document describes a C++ program that implements a binary tree data structure with various methods. It includes class definitions for a tree node (TreeStruct), the tree itself (Tree), and stacks and queues used in tree traversals. Many methods of the Tree class are only declared, leaving them to be implemented. The main() function inserts nodes into a sample tree and tests various tree operations. It provides output examples to check if the implemented methods are working correctly.
Mohammad Imam Hossain is a lecturer in the Department of Computer Science and Engineering at UIU. His email is provided. The document discusses C++ including its history and structure, input/output, file I/O, STL containers like vector, stack, queue and map, and strings. Key STL concepts covered are containers, iterators, insertion, deletion, searching and accessing elements.
AvlTree.h
#ifndef AVL_TREE_H
#define AVL_TREE_H
#include "dsexceptions.h"
#include <iostream> // For NULL
#include <queue> // For level order printout
#include <vector>
#include <algorithm> // For max() function
using namespace std;
// AvlTree class
//
// CONSTRUCTION: with ITEM_NOT_FOUND object used to signal failed finds
//
// ******************PUBLIC OPERATIONS*********************
// Programming Assignment Part I
// bool empty( ) --> Test for empty tree @ root
// int size( ) --> Quantity of elements in tree
// int height( ) --> Height of the tree (null == -1)
// void insert( x ) --> Insert x
// void insert( vector<T> ) --> Insert whole vector of values
// void remove( x ) --> Remove x (unimplemented)
// bool contains( x ) --> Return true if x is present
// Comparable findMin( ) --> Return smallest item
// Comparable findMax( ) --> Return largest item
// boolean isEmpty( ) --> Return true if empty; else false
// void printTree( ) --> Print tree in sorted (in) order
// void printPreOrder( ) --> Print tree in pre order
// void printPostOrder( ) --> Print tree in post order
// void printInOrder( ) --> Print tree in *in* order
// Programming Assignment Part II (microassignment)
// void makeEmpty( ) --> Remove and delete all items
// void ~AvlTree( ) --> Big Five Destructor
// AvlTree(const AvlTree &other) --> BigFive Copy Constructor
// AvlTree(const AvlTree &&other) --> BigFive Move Constructor
// AvlTree &operator= ( AvlTree & other ) --> Big Five Copy *assignment* operator
// AvlTree &operator= ( AvlTree && other ) --> Big Five Move *assignment* operator
// void printLevelOrder( ) --> Print tree in LEVEL order :-)
// ******************ERRORS********************************
// Throws UnderflowException as warranted
template <typename Comparable>
class AvlTree
{
public:
/**
* Basic constructor for an empty tree
*/
AvlTree( ) : root( NULL )
{
//cout << " [d] AvlTree constructor called. " << endl;
}
/**
* Vector of data initializer (needed for move= operator rvalue)
*/
AvlTree( vector<Comparable> vals ) : root( NULL )
{
insert(vals);
}
//*******************************************************************************************
// START AVL TREES PART II - TODO: Implement
// Other functions to look for include: clone, makeEmpty, printLevelOrder
/**
* Destroy contents of the AvlTree object - Big Five Destructor
*/
~AvlTree( )
{
//cout << " [d] AvlTree Destructor called. " << endl;
// Empty out the AVL Tree and destroy all nodes (makeEmpty?)
}
/**
* Copy other to new object - Big Five Copy Constructor
*/
AvlTree( const AvlTree &other ) : root( NULL )
{
cout << " [d] Copy Constructor Called." << endl;
// Copy contents of other to ourselves (maybe clone?)
// Get a deep copy of other's tree
}
/* ...
This document provides information about stacks, queues, and hashing. It describes stacks as data structures where the last item inserted is the first item accessed. Common stack operations like push(), pop(), and peek() are discussed. Array and linked list implementations of stacks are presented. Examples of stack applications in compiler design, expression evaluation, and spell checking are given. Queues are defined as structures where the first item inserted is the first item accessed (FIFO). Circular queue implementations are described to avoid overflow issues. Deques, which allow insertion and removal from both ends, are also introduced. Implementation of queues using arrays is demonstrated with methods like enqueue(), dequeue(), and isEmpty().
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfrohit219406
The document provides code for implementing a binary search tree (BST) data structure in C++. It includes the class declaration and functions for inserting nodes, deleting nodes, and traversing the tree using preorder, inorder and postorder traversal. It also includes functions for finding a node, displaying the tree structure, and a main function containing a menu of operations for testing the BST implementation.
//g++ -o simpleVector.exe simpleVector.cpp
#include
#include
#include
using namespace std;
/******************************************************
* Template class named SimpleVector
* An array that can hold any specified
* data type. Use a dynamic array.
******************************************************/
template
class SimpleVector
{
public:
//default constructor
SimpleVector();
//constructor with size of array
SimpleVector(int size);
//copy constructor
SimpleVector(const SimpleVector& object);
//setter method
void SetArray(int size);
//getter method
void ShowArray(int size);
//destructor
void FreeMemory();
//accessor method
int GetSizeOfArray();
//getter method
T GetElementAt(int index);
//Overload the [] operator. The argument is a subscript.
//This function returns a reference
//to the element in the array indexed by the subscript.
T operator [] (int subscript);
private:
//private memeber variable
T *array; //to dynamically allocate an array
T *copy;
};
//These function are going to be used in switch statement
//in order to test each case(integer, double, string).
void caseOne(int userInput, int size);
void caseTwo(int userInput, int size);
void caseThree(int userInput, int size);
int main() {
int userInput;
int size;
char keepInput;
do {
cout << \"What type of data do you want?\ \";
cout <<\"1. intger\ \";
cout <<\"2. double\ \";
cout <<\"3. strings\ \";
cin >> userInput;
cout << \"Enter the number of data \";
cin >> size;
switch(userInput) {
case 1:
{
caseOne(userInput, size);
break;
}
case 2:
{
caseTwo(userInput, size);
break;
}
case 3:
{
caseThree(userInput, size);
break;
}
default:
cout << \"invalid input\";
}
cout << \"\ Do you want to enter the data again?(Y/N)\ \";
cin >> keepInput;
} while(toupper(keepInput) == \'Y\');
return 0;
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'int\' type.
void caseOne(int userInput, int size) {
SimpleVectorintegerData(size);
integerData.SetArray(size);
integerData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << integerData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << integerData[userInput];
cout << \"\ \ Copying the array\";
SimpleVectornewIntegerData(integerData);
newIntegerData.ShowArray(size);
newIntegerData.FreeMemory();
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'double\' type.
void caseTwo(int userInput, int size) {
SimpleVectordoubleData(size);
doubleData.SetArray(size);
doubleData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << doubleData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << doubleData[.
Complete the C++ program and implement the routines that are not .docxAbdulrahman890100
The document describes a C++ program that implements a binary tree data structure with various node-related methods like insertion, searching, and traversal. It includes class definitions for the tree nodes (TreeStruct), the overall tree (Tree), and auxiliary stack and queue classes. Many methods are only declared, leaving their implementation incomplete. The main() function tests the various methods by building a sample tree and printing outputs.
Complete the C++ program and implement the routines that are not .docxShiraPrater50
The document describes a C++ program that implements a binary tree data structure with various methods. It includes class definitions for a tree node (TreeStruct), the tree itself (Tree), and stacks and queues used in tree traversals. Many methods of the Tree class are only declared, leaving them to be implemented. The main() function inserts nodes into a sample tree and tests various tree operations. It provides output examples to check if the implemented methods are working correctly.
Mohammad Imam Hossain is a lecturer in the Department of Computer Science and Engineering at UIU. His email is provided. The document discusses C++ including its history and structure, input/output, file I/O, STL containers like vector, stack, queue and map, and strings. Key STL concepts covered are containers, iterators, insertion, deletion, searching and accessing elements.
AvlTree.h
#ifndef AVL_TREE_H
#define AVL_TREE_H
#include "dsexceptions.h"
#include <iostream> // For NULL
#include <queue> // For level order printout
#include <vector>
#include <algorithm> // For max() function
using namespace std;
// AvlTree class
//
// CONSTRUCTION: with ITEM_NOT_FOUND object used to signal failed finds
//
// ******************PUBLIC OPERATIONS*********************
// Programming Assignment Part I
// bool empty( ) --> Test for empty tree @ root
// int size( ) --> Quantity of elements in tree
// int height( ) --> Height of the tree (null == -1)
// void insert( x ) --> Insert x
// void insert( vector<T> ) --> Insert whole vector of values
// void remove( x ) --> Remove x (unimplemented)
// bool contains( x ) --> Return true if x is present
// Comparable findMin( ) --> Return smallest item
// Comparable findMax( ) --> Return largest item
// boolean isEmpty( ) --> Return true if empty; else false
// void printTree( ) --> Print tree in sorted (in) order
// void printPreOrder( ) --> Print tree in pre order
// void printPostOrder( ) --> Print tree in post order
// void printInOrder( ) --> Print tree in *in* order
// Programming Assignment Part II (microassignment)
// void makeEmpty( ) --> Remove and delete all items
// void ~AvlTree( ) --> Big Five Destructor
// AvlTree(const AvlTree &other) --> BigFive Copy Constructor
// AvlTree(const AvlTree &&other) --> BigFive Move Constructor
// AvlTree &operator= ( AvlTree & other ) --> Big Five Copy *assignment* operator
// AvlTree &operator= ( AvlTree && other ) --> Big Five Move *assignment* operator
// void printLevelOrder( ) --> Print tree in LEVEL order :-)
// ******************ERRORS********************************
// Throws UnderflowException as warranted
template <typename Comparable>
class AvlTree
{
public:
/**
* Basic constructor for an empty tree
*/
AvlTree( ) : root( NULL )
{
//cout << " [d] AvlTree constructor called. " << endl;
}
/**
* Vector of data initializer (needed for move= operator rvalue)
*/
AvlTree( vector<Comparable> vals ) : root( NULL )
{
insert(vals);
}
//*******************************************************************************************
// START AVL TREES PART II - TODO: Implement
// Other functions to look for include: clone, makeEmpty, printLevelOrder
/**
* Destroy contents of the AvlTree object - Big Five Destructor
*/
~AvlTree( )
{
//cout << " [d] AvlTree Destructor called. " << endl;
// Empty out the AVL Tree and destroy all nodes (makeEmpty?)
}
/**
* Copy other to new object - Big Five Copy Constructor
*/
AvlTree( const AvlTree &other ) : root( NULL )
{
cout << " [d] Copy Constructor Called." << endl;
// Copy contents of other to ourselves (maybe clone?)
// Get a deep copy of other's tree
}
/* ...
This document provides information about stacks, queues, and hashing. It describes stacks as data structures where the last item inserted is the first item accessed. Common stack operations like push(), pop(), and peek() are discussed. Array and linked list implementations of stacks are presented. Examples of stack applications in compiler design, expression evaluation, and spell checking are given. Queues are defined as structures where the first item inserted is the first item accessed (FIFO). Circular queue implementations are described to avoid overflow issues. Deques, which allow insertion and removal from both ends, are also introduced. Implementation of queues using arrays is demonstrated with methods like enqueue(), dequeue(), and isEmpty().
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfrohit219406
The document provides code for implementing a binary search tree (BST) data structure in C++. It includes the class declaration and functions for inserting nodes, deleting nodes, and traversing the tree using preorder, inorder and postorder traversal. It also includes functions for finding a node, displaying the tree structure, and a main function containing a menu of operations for testing the BST implementation.
//g++ -o simpleVector.exe simpleVector.cpp
#include
#include
#include
using namespace std;
/******************************************************
* Template class named SimpleVector
* An array that can hold any specified
* data type. Use a dynamic array.
******************************************************/
template
class SimpleVector
{
public:
//default constructor
SimpleVector();
//constructor with size of array
SimpleVector(int size);
//copy constructor
SimpleVector(const SimpleVector& object);
//setter method
void SetArray(int size);
//getter method
void ShowArray(int size);
//destructor
void FreeMemory();
//accessor method
int GetSizeOfArray();
//getter method
T GetElementAt(int index);
//Overload the [] operator. The argument is a subscript.
//This function returns a reference
//to the element in the array indexed by the subscript.
T operator [] (int subscript);
private:
//private memeber variable
T *array; //to dynamically allocate an array
T *copy;
};
//These function are going to be used in switch statement
//in order to test each case(integer, double, string).
void caseOne(int userInput, int size);
void caseTwo(int userInput, int size);
void caseThree(int userInput, int size);
int main() {
int userInput;
int size;
char keepInput;
do {
cout << \"What type of data do you want?\ \";
cout <<\"1. intger\ \";
cout <<\"2. double\ \";
cout <<\"3. strings\ \";
cin >> userInput;
cout << \"Enter the number of data \";
cin >> size;
switch(userInput) {
case 1:
{
caseOne(userInput, size);
break;
}
case 2:
{
caseTwo(userInput, size);
break;
}
case 3:
{
caseThree(userInput, size);
break;
}
default:
cout << \"invalid input\";
}
cout << \"\ Do you want to enter the data again?(Y/N)\ \";
cin >> keepInput;
} while(toupper(keepInput) == \'Y\');
return 0;
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'int\' type.
void caseOne(int userInput, int size) {
SimpleVectorintegerData(size);
integerData.SetArray(size);
integerData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << integerData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << integerData[userInput];
cout << \"\ \ Copying the array\";
SimpleVectornewIntegerData(integerData);
newIntegerData.ShowArray(size);
newIntegerData.FreeMemory();
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'double\' type.
void caseTwo(int userInput, int size) {
SimpleVectordoubleData(size);
doubleData.SetArray(size);
doubleData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << doubleData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << doubleData[.
RightTriangle/rightTriangle.cppRightTriangle/rightTriangle.cpp// This file includes implementations for functions of the right
// triangle class.
#include<iostream>
#include<cmath>
usingnamespace std;
#include"rightTriangle.h"
// Default constructor
RightTriangle::RightTriangle()
{
base =0;
height =0;
}
// SET functions (for storing data in private data members)
voidRightTriangle::setHeight(double h)
{
height = h;
}
voidRightTriangle::setBase(double b)
{
base = b;
}
// Calculate length of hypotenuse using
// Pythagorean Theorem
doubleRightTriangle::calcHypotenuse()
{
return sqrt (base * base + height * height);
}
__MACOSX/RightTriangle/._rightTriangle.cpp
RightTriangle/rightTriangle.h
// This file defines the specifications for a class to store
// attributes of a right triangle
class RightTriangle
{
private: // PRIVATE data members
double base;
double height;
public: // PUBLIC member functions
RightTriangle(); // Default constructor
void setHeight(double h); // SET functions
void setBase(double b);
// Calculate length of hypotenuse
double calcHypotenuse();
};
__MACOSX/RightTriangle/._rightTriangle.h
RightTriangle/testTriangle.cppRightTriangle/testTriangle.cpp// This program calculates various parameters of a
// right triangle.
#include<iostream>
usingnamespace std;
#include"rightTriangle.h"
int main()
{
// Declaration
double base,height;
RightTriangle aTriangle;
// Input
cout <<"Enter the base of the triangle: ";
cin >> base;
cout <<"Enter the height of the triangle: ";
cin >> height;
// Move data to object
aTriangle.setBase(base);
aTriangle.setHeight(height);
// Calculations and output
cout << endl;
cout <<"Length of hypotenuse: "
<< aTriangle.calcHypotenuse()<< endl;
return0;
}// end main function
__MACOSX/RightTriangle/._testTriangle.cpp
c++practice3a3b/._rightTriangle.cpp
c++practice3a3b/._rightTriangle.h
c++practice3a3b/._testTriangle.cpp
c++practice3a3b/partList.txt
2345 Snoozle 15.4 29.95
1234 Widget 5.4 9.99
3456 Bludger 9.1 15.49
5678 Zeeter 7.7 1.99
6789 Sub_Tweezer 12.3 5.25
4567 Woofle 3.7 49.79
c++practice3a3b/partMgr.cppc++practice3a3b/partMgr.cpp// This program manages a list of parts.
#include<iostream>
#include<iomanip>
#include<fstream>
usingnamespace std;
// Attributes for one part
struct partInfo
{
int number;
char name[30];
double weight;
double price;
};
constint MAX_LIST_SIZE =100;
// Function prototypes
int menu();
void buildPartsList(partInfo partList[],int& listSize);
void searchParts(partInfo partList[],int numParts);
void listParts(partInfo partList[],int& numParts);
void insertPart(partInfo list[],int& numElems);
void deletePart(partInfo list[],int& numElems);
partInfo getPartInfo();
v ...
I just need code for processQueue function using iterators from the .pdfallurafashions98
I just need code for processQueue function using iterators from the linkedList class.
#include
#include
#include
#include
#include "Queuecpp.h"
#include "Songcpp.h"
#include "RequestCpp.h"
void populateRequests(Queue& q);
void populateSongDataBase(LinkedList &list);
void processQueue(LinkedList &list,Queue& q);
void processRequest(std::string action, std::string title,std::string singer,int chartPos);
//GIVEN
int main() {
LinkedList list;
Queue q;
populateSongDataBase(list); // fill the Songs Data Base into Linked List
std::cout<<"*************************************\n";
list.printList(); //
std::cout<<"*************************************\n";
populateRequests(q); // fill the request q
std::cout<<"\n";
std::cout<<"---------------PRINTING QUEUE-------------------\n";
q.printList();
std::cout<<"------------------------------------\n";
processQueue(list,q); // process the requests
std::cout<<"*************************************\n";
list.printList();
std::cout<<"*************************************\n";
}
//GIVEN
//Requires an empty linked list
//Effects fills the list with request by reading from the RequestData.txt
//Modifies the queue by filling it
void populateRequests(Queue &q){
}
//GIVEN
//Requires Filled data base , song to play
//Effects Finds song using get, if found plays it
//Modifies nothing
std::string playSong(LinkedList&list, Song s){
if (list.get(s)>=0){
return "PLAYING :"+ s.toString()+"\n";
}
else{
return "SONG NOT FOUND\n";
}
}
//GIVEN
//Requires filled database
//Effects calls print methood to print top ten songs
//Modifies nothing
void printTopTenSongs(LinkedList& list){
std::cout<<"PLAYING TOP TEN SONG __________\n";
list.print(10);
;
}
//Requires filled Song Database, a Song to add. The chart position given in the song is where it
will get added. Note this is a Song that is not supposed to exist in database.
//Effects adds the song from its original chart position
//Modifies the Song database. Adjust chart position of all Songs affected by this addition- this
adjustment is done in insert method using adjustPosition method. If the Process Queue adds a
Song that already is in the database, then a duplicate entry can occur.
//TODO
void addThisSong(LinkedList &list, Song s){
//TODO
/* Use this code
if (found>=0) {std::cout<<"ADDED THIS SONG "< &list, Song s){
/* Use this code
if (found>=0) {std::cout<<"SORRY CANNOT REMOVE THIS SONG - STILL FOUND AT
"< &list, Song s, int pos){
int chartPos=list.get(s);
std::cout<<"MOVING SONG "< &list,std::string action, std::string title,std::string singer,int
chartPos){
Song s(title,singer,chartPos);
char ch =action[0];
switch(ch){
case 'P' : std::cout< &list ,Queue& q){
int requestNumber=1;
//Create an iterator for the Queue to iteratate through requests
std::cout<<"-------------------------------------------------------------------------\n";
// call processRequest
std::cout<<"-------------------------------------------------------------------------\n"
std::cout<<"------------------------.
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 following functions in c++ singleRotation putNo.pdfabbecindia
complete the following functions in c++
singleRotation
putNode: Insert or update the entry in the extended AVL tree map (TreeMapStats) using
the inputted key and value. In addition, efficiently update the statistics information of only
the nodes affected by the insertion of the new entry into the map
eraseNode: Remove the entry in the extended AVL tree map (TreeMapStats) with the
inputted key, if the key is in the map, if necessary. In addition, efficiently update the statistics
information of only the nodes affected by the removal of the new entry from the map
also right a function updateStats
class TreeMapStats : public AVLTreeMap {
public:
// embedded node class extension of an AVL-Tree node
class Node : public AVLTreeMap::Node {
private:
// stats class to account for basic statistics/information of subtree rooted at each node
class Stats {
private:
// data members: number of nodes/map entries stored in the subtree; sum of all the map values of
map entries stored in the subtree; the minimum map value of all the map entries stored in the
subtree; the maximum map value of the map entries stored in the subtree
int num;
int sum;
int min;
int max;
public:
// stats constructors
Stats() { };
Stats(int v, Node *l, Node* r) : num(1), sum(v), min(v), max(v) {
};
// stats destructor
~Stats() { };
// overloading output stream for a representation of stats s
friend ostream& operator<<(ostream& os, const Stats& s) {
os << "{" << s.num << "," << s.sum << "," << s.min << "," << s.max << "}";
return os;
};
};
// data member: node info/stats
Stats *info;
public:
// tree node constructors
Node() : AVLTreeMap::Node() { };
Node(int k, int v, Node* l, Node* r, Node* p) : AVLTreeMap::Node(k,v,l,r,p) {
info = new Stats(v, l, r);
};
// tree node destructor
virtual ~Node() { if (this->info) delete this->info; };
// overloading output stream for a representation of TreeMapStats node w
friend ostream& operator<<(ostream& os, const Node& w) {
os << ((AVLTreeMap::Node) w) << *(w.info) ;
return os;
};
// (overloading) print utility for a node, including map entry and additional info and stats
void printStats() { cout << *this << endl; }
/*
# PRECONDITION: the info values for the left and right nodes for the children of the node have
been properly set, consistent with the subtree that they root
# POSTCONDITION: the info values for the node have been properly set, consistent with the
subtree that it roots
*/
};
// print utilities
void printTreeMapStats();
void printTreeMapStats(Node* w);
void printTreeMap();
// tree constructor
TreeMapStats() { };
// tree desctructor
virtual ~TreeMapStats() { };
protected:
// (overloadable) auxiliary node creation utility
virtual Node* createNode(int k, int v, BSTMap::Node* l, BSTMap::Node* r, BSTMap::Node* p) {
return new Node(k,v,(Node*) l, (Node*) r, (Node*) p); };
// prints a representation of AVL node w
// (overloadable)
// INPUT: node w
virtual void printNode(const BSTMap::Node* w) const { if (w) cout << *((Node*) w); };
// (overloa.
in this assignment you are asked to write a simple driver program an.pdfmichardsonkhaicarr37
in this assignment you are asked to write a simple driver program and set of functions (maybein
a library) that can be performed on a binary search tree.
Your program should allow user to insert/delete integer values into the binary search tree along
with several other operations on the binary search tree. You can use the code given in slides. But
this time your key will be int! Specifically, your program will ask user to enter a command and
related parameters (if any) in a loop, and then perform the given commands. Here is the list of
commands that your program must implement:
* insert
*find\'
*delete
*list inorder
*list preorder
*list postorder
*list levelorder
* max
* min
* height
*count
* sum
*quit
As always, make sure you release (free) the dynamically allocated memories if you allocate any
memory in your programs. So, before submitting your program, run it with valgrind to see if
there is any memory leakage
//my proggram in C
struct tree_node {
int data;
struct tree_node *left, *right;
}
typedef struct nodeT {
int key;
struct nodeT *left, *right;
} nodeT, *treeT;
int main(){
while (TRUE) {
printf(\"> \");
line = GetLine();
ch = toupper(line[0]);
switch (ch) {
case \'I\': insert(); break;
case \'F\': find(); break;
case \'D\': delete(); break;
case \'LI\': listInorder; break;
case \'LPR\': listPreorder(); break;
case \'LPO\': listPostorder(); break;
case \'MAX\': max(); break;
case \'min\': min(); break;
case \'H\': height(); break;
case \'C\': count(); break;
case \'S\': sum(); break;
case \'Q\': exit(0);
default:printf(\"Illegal command\ \"); break;
}
}
}
nodeT *FindNode(nodeT *t, int key){
while(t !=NULL) {
if (key == t->key) return t;
if (key < t->key) {
t = t->left;
} else {
t = t->right;
}
return NULL;
}
void delete(nodeT **p){
nodeT
*target;
target=*p;
if (target->left==NULL && target->right==NULL) {
*p=NULL;
} else if (target->left == NULL) {
*p=target->right;
} else
if (target->right == NULL) {
*p=target->left;
} else {
/* target has two children, see next slide */
}
free(target);
}
void listInorder(nodeT *T){
if (t != NULL) {
DisplayTree(t->left);
printf(“%d “, t->key);
DisplayTree(t->right);
}
}
void listPreorder(nodeT *t) {
if (t != NULL) {
printf(“%d “, t->key);
DisplayTree(t->left);
DisplayTree(t->right);
}
}
void listPostOrder(nodeT *t){
if (t != NULL) {
DisplayTree(t->left);
DisplayTree(t->right);
printf(“%d “, t->key);
}
}
void intsert(nodeT **tptr, int key){
nodeT*t, *tmp;
t=*tptr;
if (t == NULL) {
tmp=New(nodeT*);
tmp->key = key;
tmp->left=tmp->right=NULL;
*tptr=tmp;
return;
}
if (key < t->key) {
InsertNode
(&t->left, key);
} else {
InsertNode(&t->right, key);
}
}
int height(nodeT *t){
if (t == NULL)
return 0;
else
return (1 + maximumof(
height(t->left),
height(t->right)) );
}
int sum(struct tree_node *p){
if (p == NULL)
return 0;
else
return (p->data +
sum(p->left) +
sum(p->right) );
}
Solution
1. /*
2. * Java Program to Implement Binary Search Tree
3. */
4.
5. import java.util.Scanner;
6.
7. /* Class BSTNode */
8. cl.
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docxAdamq0DJonese
/* Task 2: Debugging a program with stacks, queues, and doubly-linked lists There are a number of errors in the following program. All errors are located in main() and structure definitions. Function declarations and definitions are correct! Locate all errors, fix them (as shown below), run the program and save its output as a comment at the end of the source file. Example: int num = 10; int *ptr; num = &ptr; // <== Error: Comment the line and write the correct line below // Write a short justification where appropriate // num = &ptr; // Error #1 ptr = # Name: */ #include #include #include #include #define DUMMY_TRAILER '\177' // octal ASCII code of the // last character in the ASCII table #define NUM_CITIES 10 typedef struct { char name[12]; int temperature[5]; } CITY; // Stack and Queue Node typedef struct node NODE; struct node { CITY city; node *next; }; // Doubly Linked List Node typedef struct d_node D_NODE; struct d_node { CITY city; NODE *forw; NODE *back; }; // Stack Functions NODE *push(NODE *stack, const CITY *pStu); NODE *pop(NODE **stack); // Queue Functions void enqueue(NODE **queue, NODE **rear, const CITY *pStu); NODE *dequeue(NODE **queue, NODE **rear); // Doubly Linked List Functions D_NODE *init_list(void); int insert(D_NODE *list, const CITY *pStu); void traverse_forw(D_NODE *list); void traverse_back(D_NODE *list); // Other Functions void printCity(const CITY *pCity); int main (void) { CITY cList[NUM_CITIES] = { {"Cupertino", {88, 89, 87, 85, 89}}, {"Flagstaff", {81, 80, 88, 89, 89}}, {"Los Angeles", {87, 88, 89, 89, 90}}, {"Philadelphia", {96, 99, 99, 90, 95}}, {"Phoenix", {106, 109, 109, 100, 105}}, {"Portland", {89, 90, 85, 89, 90}}, {"Reno", {108, 105, 109, 100, 108}}, {"Salem", {85, 90, 85, 89, 90}}, {"Tucson", {107, 100, 109, 100, 108}}, {"Yreka", {101, 109, 100, 108, 109}} }; NODE *stack = NULL; NODE *top = NULL; NODE *queue = NULL, *rear = NULL; NODE *front; D_NODE *list; list = init_list(); // build stack and queue with data from an array of CITY structures srand((unsigned int)time(NULL)); int count = rand() % 10; for ( int n = 0; n < count; n++) { int i = rand() % NUM_CITIES; int duplicate = insert(list, &cList[i]); if(duplicate) { // already in the list! push(stack, &cList[i]); enqueue(&queue, &rear, cList[i]); } } // display list printf("\nLIST contents (forwards):\n"); traverse_forw(list); printf("\nLIST contents (backwards):\n"); traverse_back(list); // display stack if (top) { printf("\nSTACK contents from top to bottom:\n"); while ((top = pop(stack))) { printCity(top->city); } } else printf ("Empty Stack!\n"); // display queue if (front) { printf("\nQUEUE contents from front to rear:\n"); while ((front = dequeue( queue, rear))) { printCity(front->city); } } else printf ("Empty Queue!\n"); return 0; } /*************************************************** Displays the fileds of a CIS_CLASS structure Pre pCls - a pointer to a CIS_CLASS structure Post */ void printCity(const CITY *pCity) { printf("%-20s %3d\n",.
This document provides notes and code samples for using SQLite3 in C applications. It includes information on resolving link errors when building SQLite3 applications, the two forms of the LIMIT clause, using the sqlite3_get_table() function to retrieve and iterate through query results, and using the Firefox SQLite Manager add-on to view and edit SQLite databases. Code samples demonstrate getting the total record count of a table, iterating through retrieved records in different ways, and connecting and querying a SQLite database.
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 << ...
The document discusses monitoring and analyzing memory usage in Raku processes. It describes using the getrusage(2) system call to retrieve resident set size (RSS) and other memory statistics for a process. It then presents the ProcStats module, which allows periodically sampling getrusage(2) data over time to track RSS and detect changes from an initial baseline. The module outputs differences in memory statistics compared to the first sample, ignoring unchanged values. This provides a concise way to monitor for increases in a process's memory footprint over time.
This document discusses binary trees and binary search trees in C++. It includes functions to create and traverse binary trees in preorder, inorder, and postorder fashion. For binary search trees, it includes functions to insert nodes, perform inorder traversal, find the minimum value node, and delete nodes. These data structures and functions provide ways to organize and manipulate tree-based data in C++ programs.
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdfarihantmobileselepun
(1)Objective: Binary Search Tree traversal (2 points)
Use traversal.pptx as guidance to write a program to build a binary search tree Dictionary. I of
BST have the same data from each input record.
Download traversal-lab.pptx, inventory.txt, BinNode.java, BSTNode.java, BST.java,
Dictionary.java .
Perform specifications as follow:
(a)Provide Add, Delete and Retrieve functions for user to access the database. Reject duplicate
record when add a new record.
(b)Modify BST.java to add printpostOrder, printpreOrder methods.
(c)At the end, display inorder, postorder and preorder of the tree.
Codes:
/** Source code example for \"A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)\"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** ADT for binary tree nodes */
public interface BinNode {
/** Get and set the element value */
public E element();
public void setElement(E v);
/** @return The left child */
public BinNode left();
/** @return The right child */
public BinNode right();
/** @return True if a leaf node, false otherwise */
public boolean isLeaf();
}
//********************************************************************
// StringTree.java
//
//********************************************************************
import java.util.*;
public class StringTree
{
private Node root;
//----------------------------------------------------------------
// Creates an initially empty tree.
//----------------------------------------------------------------
public StringTree()
{
root = null;
}
//----------------------------------------------------------------
// Adds a string to the tree.
//----------------------------------------------------------------
public void addString (String str)
{
root = addStringToSubTree(str, root);
}
//----------------------------------------------------------------
// Adds a string to the subtree with the given root node
//----------------------------------------------------------------
private Node addStringToSubTree (String str, Node node)
{
Node result = node;
if (node == null)
result = new Node(str);
// If the new string comes before the string in the node, add
// the new string to the left child. Otherwise, add it to the
// right child.
else
if (str.compareTo(node.value) < 0)
node.left = addStringToSubTree(str, node.left);
else
node.right = addStringToSubTree(str, node.right);
return result;
}
//----------------------------------------------------------------
// Prints the result of a depth-first traversal of the tree using
// recursion.
//----------------------------------------------------------------
public void traverseWithRecursion()
{
traverseWithRecursion(root);
}
//----------------------------------------------------------------
// Prints the elements in the specified tree using recursion.
//----------------------------------------------------------------
private void traverseWithRecursion (Node node)
{
if (node != null)
{
traverseWithRecursion (node.left);
System.
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.
Need help implementing the skeleton code below, I have provided the .pdfezzi552
I need help with this practice problem?
Execute the following coding segment and identify the errors in the program. Debug the program
and provide the correct version of the code. Hinclude int main() printf(\"%s\", isdigit(\'A\') ? \"A
is digit\" \"A is not digit\"); a : a printf(\"Inlnln\") return return e;
Solution
in range [0,9]. If it\'s not then this function returns 0.
Given program compiles successfully, compiler does not give any error.
But If the input of isdigit(\'A\') is changed then the program will always print
\"A is a digit\" or
\"A is not a digit\" .
It will not print exact value of char A.
So, correct code is given below.
#include
int main()
{
char A = \'1\';
printf(\"%c%s\",A,isdigit(A)? \" is a digit\" : \" is not a digit\");
printf(\"\ \");
A = \'B\';
printf(\"%c%s\",A,isdigit(A)? \" is a digit\" : \" is not a digit\");
printf(\"\ \");
return 0;
}
Sample Output:
1 is a digit
B is not a digit.
Lab08/Lab08.cppLab08/Lab08.cpp//**************************************************************************************************************
// FILE: Lab08.cpp
//
// DESCRIPTION: Contains the main() function. Instantiates a PointTest object which tests the Point class.
//
// AUTHORS: your-name (your-email-address)
// your-partner's-name (your-partners-email-address)
//
// COURSE: CSE100 Principles of Programming with C++, Fall 2015
//
// LAB INFO: Lab 8 Date/Time: your-lab-date-and-time TA: your-lab-ta
//--------------------------------------------------------------------------------------------------------------
// TESTING:
//
// TEST CASE 1:
// ------------
// TEST CASE INPUT DATA:
// Point p1 x = 11
// Point p1 y = 22
// Point p2 x = -33
// Point p2 y = -44
//
// EXPECTED OUTPUT GIVEN THE INPUT:
// The point p1 is (11, 22)
// The point p2 is (-33, -44)
// The distance between the points is 79.322
// Moving point p1...The point p1 is now at (100, 200)
// The distance between the points is 277.894
// Moving point p2...The point p2 is now at (300, 400)
// The distance between the points is 282.843
//
// OBSERVED OUTPUT:
// Document the output from your program when you perform this test case
//
// TEST CASE RESULT: Document PASS or FAIL
//
// TEST CASE 2:
// ------------
// TEST CASE INPUT DATA:
// Point p1 x = ???
// Point p1 y = ???
// Point p2 x = ???
// Point p2 y = ???
//
// EXPECTED OUTPUT GIVEN THE INPUT:
// ??? Document the expected output ???
//
// OBSERVED OUTPUT:
// ??? Document the output from your program when you perform this test case ???
//
// TEST CASE RESULT: ??? Document PASS or FAIL ???
//**************************************************************************************************************
#include"PointTest.hpp"
//--------------------------------------------------------------------------------------------------------------
// FUNCTION: main()
//
// DESCRIPTION
// Starting point for the program.
//
// PSEUDOCODE
// Define a PointTest object named pointTest calling the default ctor.
// Call run() on the pointTest object.
// Return 0.
//--------------------------------------------------------------------------------------------------------------
???
Lab08/Point.cppLab08/Point.cpp//**************************************************************************************************************
// FILE: Point.cpp
//
// DESCRIPTION: Implementation of the Point class. See Point.hpp for the class declaration.
//
// AUTHORS: your-name (your-email-address)
// your-partner's-name (your-partners-email-address)
//
// COURSE: CSE100 Principles of Programming with C++, Fall 2015
//
// LAB INFO: Lab 8 Date/Time: your-lab-date-and-time TA: your-lab-ta
//**************************************************************************************************************
#include<cmath>// For sqrt()
#include<sstream>// For stringstre ...
Rust — это современный, практический, быстрый и безопасный язык программирования. Некоторые говорят, что Rust — это как C++, если бы его писал человек, знающий Haskell.
Система типов Rust решает главную проблему C++ — небезопасность. C++ очень легко сделать ошибки, которые приведут к поломкам (например, use after free). Rust позволяет писать безопасный код, сохраняя при этом выразительность и околонулевые накладные расходы C++. В докладе будут подробно описаны механизмы языка, которые контролируют безопасность программы.
Хотя в данный момент Rust ещё не подходит для использования в продакшне, его всё равно стоит изучать. Во-первых, потому что это очень интересный подход к программированию, а во-вторых, потому что через несколько лет для разработки требовательных к ресурсам программ будет необходим именно Rust или другой похожий инструмент.
Please read the comment ins codeExpressionTree.java-------------.pdfshanki7
Please read the comment ins code
ExpressionTree.java
----------------------------------
/**
* This is the class for Expression Tree.
* Used to create Expression Tree and Evaluate it
*/
/**
* Following logic is used to construct a Tree
* Here we use stack for Preparing Tree
* Loop through given Expression String
* If Character is Operand , Create node and push to stack
* If Character is Operator then
* 1)Create Node for Operator
* 2)Pop 2 nodes from Stack and Made
* OpretorNode--> left == first node pop
* OpretorNode--> right == second node pop
* At the end of creation of Expression Tree, Stack have only one node , which is root of
Expression tree
*/
/** Class ExpressionTree **/
class ExpressionTree
{
/** class TreeNode
* Stored Character ==> Digit(0..9) or a Operator +,-,*,/
* Left Node and Right Node
*
* **/
class TreeNode
{
char data;
TreeNode left, right;
/** constructor **/
public TreeNode(char data)
{
this.data = data;
this.left = null;
this.right = null;
}
}
/** class StackNode **/
class StackNode
{
TreeNode treeNode;
StackNode next;
/** constructor **/
public StackNode(TreeNode treeNode)
{
this.treeNode = treeNode;
next = null;
}
}
private static StackNode top;
/** constructor
* Constructor takes input string like \"+-+7*935*82*625\"
* Input should be in Prefix notation
* **/
public ExpressionTree(String expression)
{
top = null;
//Call Method for prepare expression tree
buildTree(expression);
}
/** function to clear tree **/
public void clear()
{
top = null;
}
/** function to push a node **/
private void push(TreeNode ptr)
{
if (top == null)
top = new StackNode(ptr);
else
{
StackNode nptr = new StackNode(ptr);
nptr.next = top;
top = nptr;
}
}
/** function to pop a node
* When it find operator pop 2 elements from Stack
*
* **/
private TreeNode pop()
{
if (top == null)
throw new RuntimeException(\"Underflow\");
else
{
TreeNode ptr = top.treeNode;
top = top.next;
return ptr;
}
}
/** function to get top node **/
private TreeNode peek()
{
return top.treeNode;
}
/** function to insert character **/
private void insert(char val)
{
try
{
//If Operand , Create node and push to Stack
if (isDigit(val))
{
TreeNode nptr = new TreeNode(val);
push(nptr);
}
//If Operator , Create node and popup 2 elements and make them its right and left
else if (isOperator(val))
{
TreeNode nptr = new TreeNode(val);
nptr.left = pop();
nptr.right = pop();
push(nptr);
}
}
catch (Exception e)
{
System.out.println(\"Invalid Expression\");
}
}
/** function to check if digit **/
private boolean isDigit(char ch)
{
return ch >= \'0\' && ch <= \'9\';
}
/** function to check if operator **/
private boolean isOperator(char ch)
{
return ch == \'+\' || ch == \'-\' || ch == \'*\' || ch == \'/\';
}
/** function to convert character to digit **/
private int toDigit(char ch)
{
return ch - \'0\';
}
/** function to build tree from input */
public void buildTree(String eqn)
{
for (int i = eqn.length() - 1; i >= 0; i--)
insert(eqn.charAt(i));
}
/** function to evaluate tree */
public dou.
The document discusses different approaches for extending classes with new methods in various programming languages and paradigms. It covers approaches used in dynamic languages like Python and Objective-C, as well as static languages like C++ and C#. It also proposes a template-based approach to add extension methods to C++ classes in a way that mimics how extensions work in C#.
C++ projectMachine Problem 7 - HashingWrite a program to do the .pdffeelinggift
C++ project
Machine Problem 7 - Hashing
Write a program to do the following:
loads username/password sets from the file password.txt and insert them into the hash table until
the end of file is reached on password.txt. The password.txt file will look something like this
with one username/password set per line.
mary changeMe!
The program will then present a login prompt, read one username, present a password prompt,
and after looking up the username\'s password in the hash table, will print either \"Authentication
successful\" or \"Authentication failure\".
The above step will be repeated until the end of the input data (EOF) is reached on the console
input stream (cin). The EOF character on the PC\'s is the CTRL Z character.
To convert from a string to an integer, we can add the ascii value of each character together. For
instance, Mary\'s conversion from string to integer might look something like this:
109(\'m\') + 97(\'a\') + 114(\'r\') + 121(\'y\')=441
We\'ve converted the string to an integer, but we still need to convert the integer to an index. For
an array of 10 elements we can divide by 10 and use the remainder as an index. Combining these
two hash functions, we will get Mary\'s index to be: 441 % 10 = 1
Your primary tasks for this homework are to edit the login.cpp to replace the comments with
lines so that it does the following:
Insert passwords into the Hash Table.
Retrieve one user\'s Password structure from the Hash Table.
Compare retrieved user password to input password and print \"Authentication failure\" or
\"Authentication successful.\"
//--------------------------------------------------------------------
//
// listlnk.h
//
//--------------------------------------------------------------------
#pragma warning( disable : 4290 )
#include
#include
#include
#include
#include
#include
#include
using namespace std;
template < class T > // Forward declaration of the List class
class List;
template < class T >
class ListNode // Facilitator class for the List class
{
private:
ListNode(const T &nodeData, ListNode *nextPtr);
T dataItem; // List data item
ListNode *next; // Pointer to the next list node
friend class List;
};
//--------------------------------------------------------------------
template < class T >
class List
{
public:
List(int ignored = 0);
~List();
void insert(const T &newData) throw (bad_alloc); // Insert after cursor
void remove() throw (logic_error); // Remove data item
void replace(const T &newData) throw (logic_error); // Replace data item
void clear();
bool isEmpty() const;
bool isFull() const;
// List iteration operations
void gotoBeginning() throw (logic_error);
void gotoEnd() throw (logic_error);
bool gotoNext();
bool gotoPrior();
T getCursor() const throw (logic_error); // Return item
void showStructure() const;
void moveToBeginning() throw (logic_error); // Move to beginning
void insertBefore(const T &newElement) throw (bad_alloc); // Insert before cursor
private:
ListNode *head, // Pointer to the beginni.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
More Related Content
Similar to Complete the C++ program and implement the routines that are n.docx
RightTriangle/rightTriangle.cppRightTriangle/rightTriangle.cpp// This file includes implementations for functions of the right
// triangle class.
#include<iostream>
#include<cmath>
usingnamespace std;
#include"rightTriangle.h"
// Default constructor
RightTriangle::RightTriangle()
{
base =0;
height =0;
}
// SET functions (for storing data in private data members)
voidRightTriangle::setHeight(double h)
{
height = h;
}
voidRightTriangle::setBase(double b)
{
base = b;
}
// Calculate length of hypotenuse using
// Pythagorean Theorem
doubleRightTriangle::calcHypotenuse()
{
return sqrt (base * base + height * height);
}
__MACOSX/RightTriangle/._rightTriangle.cpp
RightTriangle/rightTriangle.h
// This file defines the specifications for a class to store
// attributes of a right triangle
class RightTriangle
{
private: // PRIVATE data members
double base;
double height;
public: // PUBLIC member functions
RightTriangle(); // Default constructor
void setHeight(double h); // SET functions
void setBase(double b);
// Calculate length of hypotenuse
double calcHypotenuse();
};
__MACOSX/RightTriangle/._rightTriangle.h
RightTriangle/testTriangle.cppRightTriangle/testTriangle.cpp// This program calculates various parameters of a
// right triangle.
#include<iostream>
usingnamespace std;
#include"rightTriangle.h"
int main()
{
// Declaration
double base,height;
RightTriangle aTriangle;
// Input
cout <<"Enter the base of the triangle: ";
cin >> base;
cout <<"Enter the height of the triangle: ";
cin >> height;
// Move data to object
aTriangle.setBase(base);
aTriangle.setHeight(height);
// Calculations and output
cout << endl;
cout <<"Length of hypotenuse: "
<< aTriangle.calcHypotenuse()<< endl;
return0;
}// end main function
__MACOSX/RightTriangle/._testTriangle.cpp
c++practice3a3b/._rightTriangle.cpp
c++practice3a3b/._rightTriangle.h
c++practice3a3b/._testTriangle.cpp
c++practice3a3b/partList.txt
2345 Snoozle 15.4 29.95
1234 Widget 5.4 9.99
3456 Bludger 9.1 15.49
5678 Zeeter 7.7 1.99
6789 Sub_Tweezer 12.3 5.25
4567 Woofle 3.7 49.79
c++practice3a3b/partMgr.cppc++practice3a3b/partMgr.cpp// This program manages a list of parts.
#include<iostream>
#include<iomanip>
#include<fstream>
usingnamespace std;
// Attributes for one part
struct partInfo
{
int number;
char name[30];
double weight;
double price;
};
constint MAX_LIST_SIZE =100;
// Function prototypes
int menu();
void buildPartsList(partInfo partList[],int& listSize);
void searchParts(partInfo partList[],int numParts);
void listParts(partInfo partList[],int& numParts);
void insertPart(partInfo list[],int& numElems);
void deletePart(partInfo list[],int& numElems);
partInfo getPartInfo();
v ...
I just need code for processQueue function using iterators from the .pdfallurafashions98
I just need code for processQueue function using iterators from the linkedList class.
#include
#include
#include
#include
#include "Queuecpp.h"
#include "Songcpp.h"
#include "RequestCpp.h"
void populateRequests(Queue& q);
void populateSongDataBase(LinkedList &list);
void processQueue(LinkedList &list,Queue& q);
void processRequest(std::string action, std::string title,std::string singer,int chartPos);
//GIVEN
int main() {
LinkedList list;
Queue q;
populateSongDataBase(list); // fill the Songs Data Base into Linked List
std::cout<<"*************************************\n";
list.printList(); //
std::cout<<"*************************************\n";
populateRequests(q); // fill the request q
std::cout<<"\n";
std::cout<<"---------------PRINTING QUEUE-------------------\n";
q.printList();
std::cout<<"------------------------------------\n";
processQueue(list,q); // process the requests
std::cout<<"*************************************\n";
list.printList();
std::cout<<"*************************************\n";
}
//GIVEN
//Requires an empty linked list
//Effects fills the list with request by reading from the RequestData.txt
//Modifies the queue by filling it
void populateRequests(Queue &q){
}
//GIVEN
//Requires Filled data base , song to play
//Effects Finds song using get, if found plays it
//Modifies nothing
std::string playSong(LinkedList&list, Song s){
if (list.get(s)>=0){
return "PLAYING :"+ s.toString()+"\n";
}
else{
return "SONG NOT FOUND\n";
}
}
//GIVEN
//Requires filled database
//Effects calls print methood to print top ten songs
//Modifies nothing
void printTopTenSongs(LinkedList& list){
std::cout<<"PLAYING TOP TEN SONG __________\n";
list.print(10);
;
}
//Requires filled Song Database, a Song to add. The chart position given in the song is where it
will get added. Note this is a Song that is not supposed to exist in database.
//Effects adds the song from its original chart position
//Modifies the Song database. Adjust chart position of all Songs affected by this addition- this
adjustment is done in insert method using adjustPosition method. If the Process Queue adds a
Song that already is in the database, then a duplicate entry can occur.
//TODO
void addThisSong(LinkedList &list, Song s){
//TODO
/* Use this code
if (found>=0) {std::cout<<"ADDED THIS SONG "< &list, Song s){
/* Use this code
if (found>=0) {std::cout<<"SORRY CANNOT REMOVE THIS SONG - STILL FOUND AT
"< &list, Song s, int pos){
int chartPos=list.get(s);
std::cout<<"MOVING SONG "< &list,std::string action, std::string title,std::string singer,int
chartPos){
Song s(title,singer,chartPos);
char ch =action[0];
switch(ch){
case 'P' : std::cout< &list ,Queue& q){
int requestNumber=1;
//Create an iterator for the Queue to iteratate through requests
std::cout<<"-------------------------------------------------------------------------\n";
// call processRequest
std::cout<<"-------------------------------------------------------------------------\n"
std::cout<<"------------------------.
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 following functions in c++ singleRotation putNo.pdfabbecindia
complete the following functions in c++
singleRotation
putNode: Insert or update the entry in the extended AVL tree map (TreeMapStats) using
the inputted key and value. In addition, efficiently update the statistics information of only
the nodes affected by the insertion of the new entry into the map
eraseNode: Remove the entry in the extended AVL tree map (TreeMapStats) with the
inputted key, if the key is in the map, if necessary. In addition, efficiently update the statistics
information of only the nodes affected by the removal of the new entry from the map
also right a function updateStats
class TreeMapStats : public AVLTreeMap {
public:
// embedded node class extension of an AVL-Tree node
class Node : public AVLTreeMap::Node {
private:
// stats class to account for basic statistics/information of subtree rooted at each node
class Stats {
private:
// data members: number of nodes/map entries stored in the subtree; sum of all the map values of
map entries stored in the subtree; the minimum map value of all the map entries stored in the
subtree; the maximum map value of the map entries stored in the subtree
int num;
int sum;
int min;
int max;
public:
// stats constructors
Stats() { };
Stats(int v, Node *l, Node* r) : num(1), sum(v), min(v), max(v) {
};
// stats destructor
~Stats() { };
// overloading output stream for a representation of stats s
friend ostream& operator<<(ostream& os, const Stats& s) {
os << "{" << s.num << "," << s.sum << "," << s.min << "," << s.max << "}";
return os;
};
};
// data member: node info/stats
Stats *info;
public:
// tree node constructors
Node() : AVLTreeMap::Node() { };
Node(int k, int v, Node* l, Node* r, Node* p) : AVLTreeMap::Node(k,v,l,r,p) {
info = new Stats(v, l, r);
};
// tree node destructor
virtual ~Node() { if (this->info) delete this->info; };
// overloading output stream for a representation of TreeMapStats node w
friend ostream& operator<<(ostream& os, const Node& w) {
os << ((AVLTreeMap::Node) w) << *(w.info) ;
return os;
};
// (overloading) print utility for a node, including map entry and additional info and stats
void printStats() { cout << *this << endl; }
/*
# PRECONDITION: the info values for the left and right nodes for the children of the node have
been properly set, consistent with the subtree that they root
# POSTCONDITION: the info values for the node have been properly set, consistent with the
subtree that it roots
*/
};
// print utilities
void printTreeMapStats();
void printTreeMapStats(Node* w);
void printTreeMap();
// tree constructor
TreeMapStats() { };
// tree desctructor
virtual ~TreeMapStats() { };
protected:
// (overloadable) auxiliary node creation utility
virtual Node* createNode(int k, int v, BSTMap::Node* l, BSTMap::Node* r, BSTMap::Node* p) {
return new Node(k,v,(Node*) l, (Node*) r, (Node*) p); };
// prints a representation of AVL node w
// (overloadable)
// INPUT: node w
virtual void printNode(const BSTMap::Node* w) const { if (w) cout << *((Node*) w); };
// (overloa.
in this assignment you are asked to write a simple driver program an.pdfmichardsonkhaicarr37
in this assignment you are asked to write a simple driver program and set of functions (maybein
a library) that can be performed on a binary search tree.
Your program should allow user to insert/delete integer values into the binary search tree along
with several other operations on the binary search tree. You can use the code given in slides. But
this time your key will be int! Specifically, your program will ask user to enter a command and
related parameters (if any) in a loop, and then perform the given commands. Here is the list of
commands that your program must implement:
* insert
*find\'
*delete
*list inorder
*list preorder
*list postorder
*list levelorder
* max
* min
* height
*count
* sum
*quit
As always, make sure you release (free) the dynamically allocated memories if you allocate any
memory in your programs. So, before submitting your program, run it with valgrind to see if
there is any memory leakage
//my proggram in C
struct tree_node {
int data;
struct tree_node *left, *right;
}
typedef struct nodeT {
int key;
struct nodeT *left, *right;
} nodeT, *treeT;
int main(){
while (TRUE) {
printf(\"> \");
line = GetLine();
ch = toupper(line[0]);
switch (ch) {
case \'I\': insert(); break;
case \'F\': find(); break;
case \'D\': delete(); break;
case \'LI\': listInorder; break;
case \'LPR\': listPreorder(); break;
case \'LPO\': listPostorder(); break;
case \'MAX\': max(); break;
case \'min\': min(); break;
case \'H\': height(); break;
case \'C\': count(); break;
case \'S\': sum(); break;
case \'Q\': exit(0);
default:printf(\"Illegal command\ \"); break;
}
}
}
nodeT *FindNode(nodeT *t, int key){
while(t !=NULL) {
if (key == t->key) return t;
if (key < t->key) {
t = t->left;
} else {
t = t->right;
}
return NULL;
}
void delete(nodeT **p){
nodeT
*target;
target=*p;
if (target->left==NULL && target->right==NULL) {
*p=NULL;
} else if (target->left == NULL) {
*p=target->right;
} else
if (target->right == NULL) {
*p=target->left;
} else {
/* target has two children, see next slide */
}
free(target);
}
void listInorder(nodeT *T){
if (t != NULL) {
DisplayTree(t->left);
printf(“%d “, t->key);
DisplayTree(t->right);
}
}
void listPreorder(nodeT *t) {
if (t != NULL) {
printf(“%d “, t->key);
DisplayTree(t->left);
DisplayTree(t->right);
}
}
void listPostOrder(nodeT *t){
if (t != NULL) {
DisplayTree(t->left);
DisplayTree(t->right);
printf(“%d “, t->key);
}
}
void intsert(nodeT **tptr, int key){
nodeT*t, *tmp;
t=*tptr;
if (t == NULL) {
tmp=New(nodeT*);
tmp->key = key;
tmp->left=tmp->right=NULL;
*tptr=tmp;
return;
}
if (key < t->key) {
InsertNode
(&t->left, key);
} else {
InsertNode(&t->right, key);
}
}
int height(nodeT *t){
if (t == NULL)
return 0;
else
return (1 + maximumof(
height(t->left),
height(t->right)) );
}
int sum(struct tree_node *p){
if (p == NULL)
return 0;
else
return (p->data +
sum(p->left) +
sum(p->right) );
}
Solution
1. /*
2. * Java Program to Implement Binary Search Tree
3. */
4.
5. import java.util.Scanner;
6.
7. /* Class BSTNode */
8. cl.
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docxAdamq0DJonese
/* Task 2: Debugging a program with stacks, queues, and doubly-linked lists There are a number of errors in the following program. All errors are located in main() and structure definitions. Function declarations and definitions are correct! Locate all errors, fix them (as shown below), run the program and save its output as a comment at the end of the source file. Example: int num = 10; int *ptr; num = &ptr; // <== Error: Comment the line and write the correct line below // Write a short justification where appropriate // num = &ptr; // Error #1 ptr = # Name: */ #include #include #include #include #define DUMMY_TRAILER '\177' // octal ASCII code of the // last character in the ASCII table #define NUM_CITIES 10 typedef struct { char name[12]; int temperature[5]; } CITY; // Stack and Queue Node typedef struct node NODE; struct node { CITY city; node *next; }; // Doubly Linked List Node typedef struct d_node D_NODE; struct d_node { CITY city; NODE *forw; NODE *back; }; // Stack Functions NODE *push(NODE *stack, const CITY *pStu); NODE *pop(NODE **stack); // Queue Functions void enqueue(NODE **queue, NODE **rear, const CITY *pStu); NODE *dequeue(NODE **queue, NODE **rear); // Doubly Linked List Functions D_NODE *init_list(void); int insert(D_NODE *list, const CITY *pStu); void traverse_forw(D_NODE *list); void traverse_back(D_NODE *list); // Other Functions void printCity(const CITY *pCity); int main (void) { CITY cList[NUM_CITIES] = { {"Cupertino", {88, 89, 87, 85, 89}}, {"Flagstaff", {81, 80, 88, 89, 89}}, {"Los Angeles", {87, 88, 89, 89, 90}}, {"Philadelphia", {96, 99, 99, 90, 95}}, {"Phoenix", {106, 109, 109, 100, 105}}, {"Portland", {89, 90, 85, 89, 90}}, {"Reno", {108, 105, 109, 100, 108}}, {"Salem", {85, 90, 85, 89, 90}}, {"Tucson", {107, 100, 109, 100, 108}}, {"Yreka", {101, 109, 100, 108, 109}} }; NODE *stack = NULL; NODE *top = NULL; NODE *queue = NULL, *rear = NULL; NODE *front; D_NODE *list; list = init_list(); // build stack and queue with data from an array of CITY structures srand((unsigned int)time(NULL)); int count = rand() % 10; for ( int n = 0; n < count; n++) { int i = rand() % NUM_CITIES; int duplicate = insert(list, &cList[i]); if(duplicate) { // already in the list! push(stack, &cList[i]); enqueue(&queue, &rear, cList[i]); } } // display list printf("\nLIST contents (forwards):\n"); traverse_forw(list); printf("\nLIST contents (backwards):\n"); traverse_back(list); // display stack if (top) { printf("\nSTACK contents from top to bottom:\n"); while ((top = pop(stack))) { printCity(top->city); } } else printf ("Empty Stack!\n"); // display queue if (front) { printf("\nQUEUE contents from front to rear:\n"); while ((front = dequeue( queue, rear))) { printCity(front->city); } } else printf ("Empty Queue!\n"); return 0; } /*************************************************** Displays the fileds of a CIS_CLASS structure Pre pCls - a pointer to a CIS_CLASS structure Post */ void printCity(const CITY *pCity) { printf("%-20s %3d\n",.
This document provides notes and code samples for using SQLite3 in C applications. It includes information on resolving link errors when building SQLite3 applications, the two forms of the LIMIT clause, using the sqlite3_get_table() function to retrieve and iterate through query results, and using the Firefox SQLite Manager add-on to view and edit SQLite databases. Code samples demonstrate getting the total record count of a table, iterating through retrieved records in different ways, and connecting and querying a SQLite database.
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 << ...
The document discusses monitoring and analyzing memory usage in Raku processes. It describes using the getrusage(2) system call to retrieve resident set size (RSS) and other memory statistics for a process. It then presents the ProcStats module, which allows periodically sampling getrusage(2) data over time to track RSS and detect changes from an initial baseline. The module outputs differences in memory statistics compared to the first sample, ignoring unchanged values. This provides a concise way to monitor for increases in a process's memory footprint over time.
This document discusses binary trees and binary search trees in C++. It includes functions to create and traverse binary trees in preorder, inorder, and postorder fashion. For binary search trees, it includes functions to insert nodes, perform inorder traversal, find the minimum value node, and delete nodes. These data structures and functions provide ways to organize and manipulate tree-based data in C++ programs.
(1)Objective Binary Search Tree traversal (2 points)Use traversal.pdfarihantmobileselepun
(1)Objective: Binary Search Tree traversal (2 points)
Use traversal.pptx as guidance to write a program to build a binary search tree Dictionary. I of
BST have the same data from each input record.
Download traversal-lab.pptx, inventory.txt, BinNode.java, BSTNode.java, BST.java,
Dictionary.java .
Perform specifications as follow:
(a)Provide Add, Delete and Retrieve functions for user to access the database. Reject duplicate
record when add a new record.
(b)Modify BST.java to add printpostOrder, printpreOrder methods.
(c)At the end, display inorder, postorder and preorder of the tree.
Codes:
/** Source code example for \"A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)\"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** ADT for binary tree nodes */
public interface BinNode {
/** Get and set the element value */
public E element();
public void setElement(E v);
/** @return The left child */
public BinNode left();
/** @return The right child */
public BinNode right();
/** @return True if a leaf node, false otherwise */
public boolean isLeaf();
}
//********************************************************************
// StringTree.java
//
//********************************************************************
import java.util.*;
public class StringTree
{
private Node root;
//----------------------------------------------------------------
// Creates an initially empty tree.
//----------------------------------------------------------------
public StringTree()
{
root = null;
}
//----------------------------------------------------------------
// Adds a string to the tree.
//----------------------------------------------------------------
public void addString (String str)
{
root = addStringToSubTree(str, root);
}
//----------------------------------------------------------------
// Adds a string to the subtree with the given root node
//----------------------------------------------------------------
private Node addStringToSubTree (String str, Node node)
{
Node result = node;
if (node == null)
result = new Node(str);
// If the new string comes before the string in the node, add
// the new string to the left child. Otherwise, add it to the
// right child.
else
if (str.compareTo(node.value) < 0)
node.left = addStringToSubTree(str, node.left);
else
node.right = addStringToSubTree(str, node.right);
return result;
}
//----------------------------------------------------------------
// Prints the result of a depth-first traversal of the tree using
// recursion.
//----------------------------------------------------------------
public void traverseWithRecursion()
{
traverseWithRecursion(root);
}
//----------------------------------------------------------------
// Prints the elements in the specified tree using recursion.
//----------------------------------------------------------------
private void traverseWithRecursion (Node node)
{
if (node != null)
{
traverseWithRecursion (node.left);
System.
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.
Need help implementing the skeleton code below, I have provided the .pdfezzi552
I need help with this practice problem?
Execute the following coding segment and identify the errors in the program. Debug the program
and provide the correct version of the code. Hinclude int main() printf(\"%s\", isdigit(\'A\') ? \"A
is digit\" \"A is not digit\"); a : a printf(\"Inlnln\") return return e;
Solution
in range [0,9]. If it\'s not then this function returns 0.
Given program compiles successfully, compiler does not give any error.
But If the input of isdigit(\'A\') is changed then the program will always print
\"A is a digit\" or
\"A is not a digit\" .
It will not print exact value of char A.
So, correct code is given below.
#include
int main()
{
char A = \'1\';
printf(\"%c%s\",A,isdigit(A)? \" is a digit\" : \" is not a digit\");
printf(\"\ \");
A = \'B\';
printf(\"%c%s\",A,isdigit(A)? \" is a digit\" : \" is not a digit\");
printf(\"\ \");
return 0;
}
Sample Output:
1 is a digit
B is not a digit.
Lab08/Lab08.cppLab08/Lab08.cpp//**************************************************************************************************************
// FILE: Lab08.cpp
//
// DESCRIPTION: Contains the main() function. Instantiates a PointTest object which tests the Point class.
//
// AUTHORS: your-name (your-email-address)
// your-partner's-name (your-partners-email-address)
//
// COURSE: CSE100 Principles of Programming with C++, Fall 2015
//
// LAB INFO: Lab 8 Date/Time: your-lab-date-and-time TA: your-lab-ta
//--------------------------------------------------------------------------------------------------------------
// TESTING:
//
// TEST CASE 1:
// ------------
// TEST CASE INPUT DATA:
// Point p1 x = 11
// Point p1 y = 22
// Point p2 x = -33
// Point p2 y = -44
//
// EXPECTED OUTPUT GIVEN THE INPUT:
// The point p1 is (11, 22)
// The point p2 is (-33, -44)
// The distance between the points is 79.322
// Moving point p1...The point p1 is now at (100, 200)
// The distance between the points is 277.894
// Moving point p2...The point p2 is now at (300, 400)
// The distance between the points is 282.843
//
// OBSERVED OUTPUT:
// Document the output from your program when you perform this test case
//
// TEST CASE RESULT: Document PASS or FAIL
//
// TEST CASE 2:
// ------------
// TEST CASE INPUT DATA:
// Point p1 x = ???
// Point p1 y = ???
// Point p2 x = ???
// Point p2 y = ???
//
// EXPECTED OUTPUT GIVEN THE INPUT:
// ??? Document the expected output ???
//
// OBSERVED OUTPUT:
// ??? Document the output from your program when you perform this test case ???
//
// TEST CASE RESULT: ??? Document PASS or FAIL ???
//**************************************************************************************************************
#include"PointTest.hpp"
//--------------------------------------------------------------------------------------------------------------
// FUNCTION: main()
//
// DESCRIPTION
// Starting point for the program.
//
// PSEUDOCODE
// Define a PointTest object named pointTest calling the default ctor.
// Call run() on the pointTest object.
// Return 0.
//--------------------------------------------------------------------------------------------------------------
???
Lab08/Point.cppLab08/Point.cpp//**************************************************************************************************************
// FILE: Point.cpp
//
// DESCRIPTION: Implementation of the Point class. See Point.hpp for the class declaration.
//
// AUTHORS: your-name (your-email-address)
// your-partner's-name (your-partners-email-address)
//
// COURSE: CSE100 Principles of Programming with C++, Fall 2015
//
// LAB INFO: Lab 8 Date/Time: your-lab-date-and-time TA: your-lab-ta
//**************************************************************************************************************
#include<cmath>// For sqrt()
#include<sstream>// For stringstre ...
Rust — это современный, практический, быстрый и безопасный язык программирования. Некоторые говорят, что Rust — это как C++, если бы его писал человек, знающий Haskell.
Система типов Rust решает главную проблему C++ — небезопасность. C++ очень легко сделать ошибки, которые приведут к поломкам (например, use after free). Rust позволяет писать безопасный код, сохраняя при этом выразительность и околонулевые накладные расходы C++. В докладе будут подробно описаны механизмы языка, которые контролируют безопасность программы.
Хотя в данный момент Rust ещё не подходит для использования в продакшне, его всё равно стоит изучать. Во-первых, потому что это очень интересный подход к программированию, а во-вторых, потому что через несколько лет для разработки требовательных к ресурсам программ будет необходим именно Rust или другой похожий инструмент.
Please read the comment ins codeExpressionTree.java-------------.pdfshanki7
Please read the comment ins code
ExpressionTree.java
----------------------------------
/**
* This is the class for Expression Tree.
* Used to create Expression Tree and Evaluate it
*/
/**
* Following logic is used to construct a Tree
* Here we use stack for Preparing Tree
* Loop through given Expression String
* If Character is Operand , Create node and push to stack
* If Character is Operator then
* 1)Create Node for Operator
* 2)Pop 2 nodes from Stack and Made
* OpretorNode--> left == first node pop
* OpretorNode--> right == second node pop
* At the end of creation of Expression Tree, Stack have only one node , which is root of
Expression tree
*/
/** Class ExpressionTree **/
class ExpressionTree
{
/** class TreeNode
* Stored Character ==> Digit(0..9) or a Operator +,-,*,/
* Left Node and Right Node
*
* **/
class TreeNode
{
char data;
TreeNode left, right;
/** constructor **/
public TreeNode(char data)
{
this.data = data;
this.left = null;
this.right = null;
}
}
/** class StackNode **/
class StackNode
{
TreeNode treeNode;
StackNode next;
/** constructor **/
public StackNode(TreeNode treeNode)
{
this.treeNode = treeNode;
next = null;
}
}
private static StackNode top;
/** constructor
* Constructor takes input string like \"+-+7*935*82*625\"
* Input should be in Prefix notation
* **/
public ExpressionTree(String expression)
{
top = null;
//Call Method for prepare expression tree
buildTree(expression);
}
/** function to clear tree **/
public void clear()
{
top = null;
}
/** function to push a node **/
private void push(TreeNode ptr)
{
if (top == null)
top = new StackNode(ptr);
else
{
StackNode nptr = new StackNode(ptr);
nptr.next = top;
top = nptr;
}
}
/** function to pop a node
* When it find operator pop 2 elements from Stack
*
* **/
private TreeNode pop()
{
if (top == null)
throw new RuntimeException(\"Underflow\");
else
{
TreeNode ptr = top.treeNode;
top = top.next;
return ptr;
}
}
/** function to get top node **/
private TreeNode peek()
{
return top.treeNode;
}
/** function to insert character **/
private void insert(char val)
{
try
{
//If Operand , Create node and push to Stack
if (isDigit(val))
{
TreeNode nptr = new TreeNode(val);
push(nptr);
}
//If Operator , Create node and popup 2 elements and make them its right and left
else if (isOperator(val))
{
TreeNode nptr = new TreeNode(val);
nptr.left = pop();
nptr.right = pop();
push(nptr);
}
}
catch (Exception e)
{
System.out.println(\"Invalid Expression\");
}
}
/** function to check if digit **/
private boolean isDigit(char ch)
{
return ch >= \'0\' && ch <= \'9\';
}
/** function to check if operator **/
private boolean isOperator(char ch)
{
return ch == \'+\' || ch == \'-\' || ch == \'*\' || ch == \'/\';
}
/** function to convert character to digit **/
private int toDigit(char ch)
{
return ch - \'0\';
}
/** function to build tree from input */
public void buildTree(String eqn)
{
for (int i = eqn.length() - 1; i >= 0; i--)
insert(eqn.charAt(i));
}
/** function to evaluate tree */
public dou.
The document discusses different approaches for extending classes with new methods in various programming languages and paradigms. It covers approaches used in dynamic languages like Python and Objective-C, as well as static languages like C++ and C#. It also proposes a template-based approach to add extension methods to C++ classes in a way that mimics how extensions work in C#.
C++ projectMachine Problem 7 - HashingWrite a program to do the .pdffeelinggift
C++ project
Machine Problem 7 - Hashing
Write a program to do the following:
loads username/password sets from the file password.txt and insert them into the hash table until
the end of file is reached on password.txt. The password.txt file will look something like this
with one username/password set per line.
mary changeMe!
The program will then present a login prompt, read one username, present a password prompt,
and after looking up the username\'s password in the hash table, will print either \"Authentication
successful\" or \"Authentication failure\".
The above step will be repeated until the end of the input data (EOF) is reached on the console
input stream (cin). The EOF character on the PC\'s is the CTRL Z character.
To convert from a string to an integer, we can add the ascii value of each character together. For
instance, Mary\'s conversion from string to integer might look something like this:
109(\'m\') + 97(\'a\') + 114(\'r\') + 121(\'y\')=441
We\'ve converted the string to an integer, but we still need to convert the integer to an index. For
an array of 10 elements we can divide by 10 and use the remainder as an index. Combining these
two hash functions, we will get Mary\'s index to be: 441 % 10 = 1
Your primary tasks for this homework are to edit the login.cpp to replace the comments with
lines so that it does the following:
Insert passwords into the Hash Table.
Retrieve one user\'s Password structure from the Hash Table.
Compare retrieved user password to input password and print \"Authentication failure\" or
\"Authentication successful.\"
//--------------------------------------------------------------------
//
// listlnk.h
//
//--------------------------------------------------------------------
#pragma warning( disable : 4290 )
#include
#include
#include
#include
#include
#include
#include
using namespace std;
template < class T > // Forward declaration of the List class
class List;
template < class T >
class ListNode // Facilitator class for the List class
{
private:
ListNode(const T &nodeData, ListNode *nextPtr);
T dataItem; // List data item
ListNode *next; // Pointer to the next list node
friend class List;
};
//--------------------------------------------------------------------
template < class T >
class List
{
public:
List(int ignored = 0);
~List();
void insert(const T &newData) throw (bad_alloc); // Insert after cursor
void remove() throw (logic_error); // Remove data item
void replace(const T &newData) throw (logic_error); // Replace data item
void clear();
bool isEmpty() const;
bool isFull() const;
// List iteration operations
void gotoBeginning() throw (logic_error);
void gotoEnd() throw (logic_error);
bool gotoNext();
bool gotoPrior();
T getCursor() const throw (logic_error); // Return item
void showStructure() const;
void moveToBeginning() throw (logic_error); // Move to beginning
void insertBefore(const T &newElement) throw (bad_alloc); // Insert before cursor
private:
ListNode *head, // Pointer to the beginni.
Similar to Complete the C++ program and implement the routines that are n.docx (20)
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
3. t.InsertIntoTree(t.TreeRoot, 22); t.InsertIntoTree(t.TreeRoot,
23); t.InsertIntoTree(t.TreeRoot, 24);
t.InsertIntoTree(t.TreeRoot, 25); t.InsertIntoTree(t.TreeRoot,
26); t.InsertIntoTree(t.TreeRoot, 11); cout << " Printing Pre
Order " << endl; t.PrintPreOrderTree(t.TreeRoot); cout << "
-----------------------------------------------" << endl; getchar();
cout << "Printing Post Order " << endl;
t.PrintPostOrderTree(t.TreeRoot); cout << " --------------------
---------------------------" << endl; getchar(); cout <<
"Printing In Order " << endl; t.PrintInOrderTree(t.TreeRoot);
cout << " -----------------------------------------------" << endl;
getchar(); cout << boolalpha << endl << endl; cout << "
Searching 30: " << t.Search(t.TreeRoot, 30) << endl; cout <<
" Searching 8: " << t.Search(t.TreeRoot, 8) << endl; cout <<
" Searching 10: " << t.Search(t.TreeRoot, 10) << endl; cout
<< "-------------------------------------------" << endl; getchar();
cout << "Printing Pre Order with Stack " << endl;
t.PrintPreOrderTreeWithStack(t.TreeRoot); cout << " ---------
--------------------------------------" << endl; getchar(); cout <<
"Printing level by level BreathFirst Traversal " << endl;
t.PrintBreadthFirstWithQueue(t.TreeRoot); cout << " ----------
-------------------------------------" << endl; getchar(); cout <<
endl; int MaxLen = t.FindMaxLen(t.TreeRoot); int MinLen =
t.FindMinLen(t.TreeRoot); int TotalNodes =
t.CountNodes(t.TreeRoot); cout << "Max is " << MaxLen <<
endl; cout << "Min is " << MinLen << endl; cout << "Num
of Nodes is " << TotalNodes << endl; cout << "-----------------
------------------------------" << endl; getchar(); Tree t2;
Copy(t.TreeRoot, t2.TreeRoot); cout << "Printing In Order the
copy of the tree" << endl; t2.PrintInOrderTree(t2.TreeRoot);
cout << " -----------------------------------------------" << endl;
} //---------------------------------------------------------------- /*
Your output should look like the foolowing Printing Pre Order
15-->10-->8-->9-->11-->20-->17-->21-->22-->23-->24-->25--
>26--> ----------------------------------------------- Printing Post
Order 9-->8-->11-->10-->17-->26-->25-->24-->23-->22-->21--
4. >20-->15--> ----------------------------------------------- Printing
In Order 8-->9-->10-->11-->15-->17-->20-->21-->22-->23--
>24-->25-->26--> -----------------------------------------------
Searching 30: false Searching 8: true Searching 10: true -------
------------------------------------ Printing Pre Order with Stack
15-->10-->8-->9-->11-->20-->17-->21-->22-->23-->24-->25--
>26--> ----------------------------------------------- Printing level
by level BreathFirst Traversal 15-->10-->20-->8-->11-->17--
>21-->9-->22-->23-->24-->25-->26--> -----------------------------
------------------ Max is 8 Min is 3 Num of Nodes is 13 ---------
-------------------------------------- Printing In Order the copy of
the tree 8-->9-->10-->11-->15-->17-->20-->21-->22-->23-->24-
->25-->26--> ----------------------------------------------- Press any
key to continue */
Solution
Implemented the following 4 functions
void Tree::InsertIntoTree(TreeStructPtr& Root, int x) {
if (Root == NULL) {
TreeStructPtr node = new TreeStruct();
node->Number = x;
node->Left = NULL;
node->Right = NULL;
Root = node;
} else {