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

PLEASE DO NOT POST FULL SOURCE CODE ON HERE SEND IT TO GOOGLE ACCOUNT astudent96

ID: 3832602 • Letter: P

Question

PLEASE DO NOT POST FULL SOURCE CODE ON HERE SEND IT TO GOOGLE ACCOUNT astudent969....IF YOU ARE NOT COMFORTABLE WITH THE WAY I NEED THE ANSWERED VIA EMAIL YOU DO NOT HAVE TO ANSWER POST

TO GET YOUR POINTS YOU CAN POST THE CODE I PROVIDED AS THE ANSWER

Language C++:

implement a doubly linked list class,

then:

Implement a tree class based on the implementation

- you can choose either (1) use nodes to make a tree structure or (2) make a tree class based on linked lists to look like trees.

Additional functions for the tree class

- overloaded operator "=="

- traversal function

- use the quick sort code

AGAIN PLEASE DO NOT POST SOURCE CODE ON HERE...SEND IT TO GOOGLE ACCOUNT astudent969....IF YOU ARE NOT COMFORTABLE WITH THE EMAIL YOU DO NOT HAVE TO ANSWER POST

#include
using namespace std;

void swap(int &a, int &b);
int partition (int arr[], int low, int high);
void quickSort(int arr[], int low, int high);
void printArray(int arr[], int size);

void swap(int &a, int &b)
{
int t = a;
a = b;
b = t;
}

int partition (int arr[], int low, int high)
{
int pivot = arr[high]; // pivot
int i = (low - 1); // Index of smaller element

for (int j = low; j <= high- 1; j++)
{
// If current element is smaller than or
// equal to pivot
if (arr[j] <= pivot)
{
i++; // increment index of smaller element
swap(arr[i], arr[j]);
}
}
swap(arr[i + 1], arr[high]);
return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
if (low < high)
{
/* pi is partitioning index, arr[p] is now
at right place */
int pi = partition(arr, low, high);

// Separately sort elements before
// partition and after partition
quickSort(arr, low, pi - 1);
quickSort(arr, pi + 1, high);
}
}


void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
cout<

Explanation / Answer

I apologize but it's against the chegg policies to send an answer on a personal's email account. I request you to ask for the answer here itself. Meanwhile, I'm doing as you requested and answering the question as the code you provided.

By the way, your printArray() method was incomplete, so i completed it.

The code BEGINS from here:

#include <iostream>

using namespace std;

void swap(int &a, int &b);
int partition (int arr[], int low, int high);
void quickSort(int arr[], int low, int high);
void printArray(int arr[], int size);

void swap(int &a, int &b){
int t = a;
a = b;
b = t;
}

int partition (int arr[], int low, int high){
int pivot = arr[high]; // pivot
int i = (low - 1); // Index of smaller element

for (int j = low; j <= high- 1; j++){
// If current element is smaller than or
// Equal to pivot
if (arr[j] <= pivot){
i++; // increment index of smaller element
swap(arr[i], arr[j]);
}
}
  
swap(arr[i + 1], arr[high]);
return (i + 1);
}

void quickSort(int arr[], int low, int high){
if (low < high){
/* pi is partitioning index, arr[p] is now
* at right place
*/
int pi = partition(arr, low, high);

// Separately sort elements before
// partition and after partition
quickSort(arr, low, pi - 1);
quickSort(arr, pi + 1, high);
}
}


void printArray(int arr[], int size){
int i;
for (i=0; i < size; i++)
cout << arr[i] << " " ;
}

Hope you don't mind.

BEST WISHES!

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