Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please show all the steps as detail as possible.... I need help with this.... **

ID: 3824271 • Letter: P

Question

Please show all the steps as detail as possible.... I need help with this....

*****************************************************************

Need Help on C++ Programming. Can you show me and teach me how to make this programming.

*Make sure the programming is working and do not turn in a handwriting.

*Do not separate the file, use main.cpp that make me understand how to do this programming. Use "iostream"

*****************************************************************

1.

Define the Organization and access of a tree.

Access in ONLY TOP. ( pop or remove only the top )

Insert and delete ?

Organization is ? explain....

*****************************************************************

2

Define the ADT hash table.

What are collision? How can you resolve them?

*****************************************************************

3.

What are the key characteristics of an ADT map.

Give an example of its use.

*****************************************************************

4.

Draw a CLASS diagram for Maps

*****************************************************************

5.

Write a Map use the STL map for student id associated with student name and student

Explanation / Answer

1) The first question is all about the stack operations.so i have included the stack operations "push" and "pop".Run this code you can find the output how the stack works.

Source code:

#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
class stack
{
int stk[5];
int top;
public:
stack()
{
top=-1;
}
void push(int x)
{
if(top > 4)
{
cout <<"stack over flow";
return;
}
stk[++top]=x;
cout <<"inserted" <<x;
}
void pop()
{
if(top <0)
{
cout <<"stack under flow";
return;
}
cout <<"deleted" <<stk[top--];
}
void display()
{
if(top<0)
{
cout <<" stack empty";
return;
}
for(int i=top;i>=0;i--)
cout <<stk[i] <<" ";
}
};

main()
{
int ch;
stack st;
while(1)
{
cout <<" 1.push 2.pop 3.display 4.exit Enter ur choice";
cin >> ch;
switch(ch)
{
case 1: cout <<"enter the element";
cin >> ch;
st.push(ch);
break;
case 2: st.pop(); break;
case 3: st.display();break;
case 4: exit(0);
}
}
return (0);
}

2)
ADT Hash Table : ADT Hash Table is an array of elements together with an hash function and access procedures.
Collision:
   Consider an example, if the item 44 had been the next item in our collection WITH HASH VALUE OF 0 already we have 77 whos hash value is also 0 then this problem is called collision.
Collision resolving methods:
Linear probing :
This is an open adddressing technique for resolving collisions where it looks into the hash table and tries to find another open slot to hold the item that caused the collision.For this we need to go back to the first slot circularly to cover the entire hash table.

3) Adt Map:

Map is the second-most powerful kind of STL iterator.The map<T>::iterator and map<T>::reverse_iterator iterators are bidirectional iterators.The member function begin() returns the iterator position of the first element of the map, while end() is a member function returning the iterator position "one past the end" of the map. The methods rbegin() and rend() return the iterator positions of the last element, and "one before the first element", respectively.

When should a map container class be used?
The map container class should be used whenever you deal with key/value pairs which are stored in sorted key order and you need fast retrieval.

5) Sample program to display Student info using Map:

#include <iostream>
#include <map>
using namespace std;

class student
{
public:
string firstName, lastName;
int ID;


student(){}

student(string fName, string lName, int id)
{
firstName = fName;
lastName = lName;
ID = id;
}
};

class classStudents
{
public:

std::map <int, student> StudentMap;

classStudents()
{
student Students = student("Firstname", "Lastname", 123);
StudentMap.insert(std::pair<int, student>(123, Students));
}

void findStudentInfo()
{
int searchID;
cout << "Enter ID of student" << endl;
cin >> searchID;

if (StudentMap.find(searchID) == StudentMap.end())
{
printf("Student not found");
}
else
{
printf("Name: %s %s ", StudentMap[searchID].firstName, StudentMap[searchID].lastName);
}
}
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote