Question: 8 C++ Problems. These are super easy and shouldn't take too long, so take your time but try to do them all. Thanks. You'll receive
8 C++ Problems.
These are super easy and shouldn't take too long, so take your time but try to do them all. Thanks.
You'll receive multiple thumbs up for doing all of them or a lot of them. More than one person can provide a solution for different problem. I'll thumbs up all of the correct solutions.
Thank you!
==========================================
Problem 1:
Create a program to sorting a random array (20 , 100000, 500000) with 3 kinds of sort algorithms.
Bubble sort; Insert sort, selection sort
Then print out the time to execute these sort
Record the time it takes for each sort to finish sorting
==========================================
Problem 2:
Create a doubly linked list of a sentence such as Radar and find out if it is a palindrome.
You need:
-Function to add at the beginning
-Length
-In palindrome function, the head advances length/2 while the tail advance backwards.
-The program
myDoublylist mylist;
mylist.add('r');.................
cout << mylist.palindrome()
==========================================
Problem 3:
Write a function split which keeps on splitting an array of integers by the mid.
void split(....)
{
split
split
cout << "bye-bye";
}
Write a program to test this function and printing how many bye-bye will be printed (relatively to the sixe of the array chosen)
Measure the time taken to split (e.g. array of 1000 and another array of 50000)
Try sorted and unsorted array.
==========================================
Problem 4:
Write a program that uses a stack to print the prime factors of a positive integer in descending order.
If the input is 100, the output consists of four factors; 2, 2, 5 and 5.
If the input is 16, the output consists of four factors; 2, 2, 2, and 2.
If the input is 53, since it's a prime number, the output has only one factor: 53 itself.
==========================================
Problem 5:
Write a program that reads a line of text from the keyboard, changes each uppercase to lowercase, and places each leter both in a queue and onto a stack. The program should then verify whether the line of text is a palindrome (a set of letters or numbers that is the same whether read forward of backward).
Hint:
int main(){
queueType
queueType
string text;
}
==========================================
Problem 6:
Implement the array stack
class arrayStack{
private:
int *element;
int size;
public:
constructor...... get... set... add.... resize.... print....
Try all the functions in main.
==========================================
Problem 7:
Write stack as an Array and write Queue as an Array.
==========================================
Problem 8:
3 printer machines having to deal with 7 job times. Write a possible schedule for the printer machine to priortize what the printer will print first to be as efficiate as possible. You can use STL and queues.
==========================================
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
