In C++ write a class. The requirements for the class are define as followings:
Class StudentQuickSorter – This class will have the following methods with their signatures as listed below:
Sort()
This method will have two parameters. The first parameter will be an array of Student records to be sorted. The second parameter will be the number of Student records in the array.
PrintRecords()
This method will have two parameters. The first parameter will be an array of Student records to be printed. The second parameter will be the number of Student records in the array.
CODE:
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
class StudentQuickSorter
{
public:
void PrintRecords(int arr[], int n) //method to print
all the records
{
cout<<"PRINTING THE RECORDS:"<<endl;
for(int i=0;i<n;i++)
{
cout<<arr[i]<<endl;
}
}
void swap(int *n1, int *n2) // method to swap two
numbers, it is used in quick sort implementation
{
int temp;
temp = *n1;
*n1 = *n2;
*n2 = temp;
}
int partition_function(int arr[], int l, int
h) // method implementing partition
function
{
int pivot, index, i;
index = l;
pivot = h;
for(i=l; i < h; i++)
{
if(arr[i] < arr[pivot])
{
swap(&arr[i], &arr[index]);
index++;
}
}
swap(&arr[pivot], &arr[index]);
return index;
}
int pivot_partition_function(int arr[], int l, int
h) //method to genereate random pivot
partition
{
int pvt, n, temp;
n = rand();
pvt = l + n%(h-l+1);
swap(&arr[h], &arr[pvt]);
return partition_function(arr, l, h);
}
int Quick_sort_function(int arr[], int l, int
h) // quicksort function
implementation
{
int pindex;
if(l < h)
{
pindex = pivot_partition_function(arr, l, h); //finding
partition for divding input array
Quick_sort_function(arr, l, pindex-1); // dividing input
array into parts to get efficient tiem complexity
Quick_sort_function(arr, pindex+1, h);
}
return 0;
}
void Sort(int arr[],int n) //Sort method to sort the
records using quicksort algorithm
{
Quick_sort_function(arr,0,n-1);
cout<<"RECORDS SORTED"<<endl;
}
};
int main()
{
int n;
cout<<"Enter the number of students record to be added in the
array: "<<endl;
cin>>n;
cout<<"Enter "<<n<<" records now:
"<<endl;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
StudentQuickSorter object;
object.Sort(arr,n);
object.PrintRecords(arr,n);
return 0;
}
CODE IMAGE:

SAMPLE OUTPUT:

In C++ write a class. The requirements for the class are define as followings: Class StudentQuickSorter...
In C++ write a class. The requirements for the class are define as followings: Class StudentMergeSorter – This class will have the following methods with their signatures as listed below: Sort() Java - This method will receive an array of Student records to be sorted. It will sort the records by Student ID(s). It will also return the sorted array of Student records. C++ - This method will have two parameters. The first parameter will be an array of Student...
In C++ write a class. The requirements for the class are define as followings: Class StudentBubbleSorter – This class will have the following methods with their signatures as listed below: Sort() – This method will receive an array of Student records to be sorted. It will sort the records by Student ID(s). It will also return the sorted array of Student records. PrintRecords() – This method will receive an array of Student records. It will print out the information of...
Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....
Implement a software program in C++ t stores and searches the Student records using double-hashing algorithm. Double hashing uses the idea of applying a second hash function to key when a collision occurs. The software program will be based on the following requirements: Development Environment: If the software program is written in C++, its project must be created using Microsoft Visual Studio 2017. If the software program is written in Java, its project must be created using NetBeans v8.2. Algorithm: If...
Create an application that provides a solution for problem 20.8 In addition to requirements specified in the description. The class must satisfy the following Default Constructor Two argument constructor for data used to initialize "first" and "second" "toString" method for displaying the "first" and "second" data elements Creates a "Comparator" object (to be used by the sort method; i.e. create an instance of a class that implements the interface [must override "compare" and "equals" methods]) The application must create an...
Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...
Write a class encapsulating the concept of daily temperatures for a week with a single dimensional array of temperatures. Write the following methods: • A constructor accepting an array of seven temperatures as a parameter. • Accessor, mutator, toString() and equals() methods • A method returning how many temperatures were below freezing. • A method returning an array of temperatures above 100 degrees. • A method returning the largest change in temperature between any two consecutive days. • A method...
The object class should be a Student with the following attributes: id: integer first name: String last name: String write the accessors, mutators, constructor, and toString(). In your main test class you will write your main method and do the following things: Create an array of Student objects with at least 5 students in your array. Write a sort method that must be your original work and included in the main class. The sort method will sort based on student...
( Object array + input) Write a Java program to meet the following requirements: 1. Define a class called Student which contains: 1.1 data fields: a. An integer data field contains student id b. Two String data fields named firstname and lastname c. A String data field contains student’s email address 1.2 methods: a. A no-arg constructor that will create a default student object. b. A constructor that creates a student with the specified student id, firstname, lastname and email_address...
. Write a class with an int array as its only instance variable. Write a recursive method that uses the following recursive strategy in order to sort the array: ❑ Sort the left half of the array (this is a recursive call). ❑ Sort the right half of the array (this is another recursive call). ❑ Merge the two sorted halves of the array so that the array is sorted (there is no recursive call here).