Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program that deletes duplicate elements from a stack.







Requirements:





No global decelerations





Test run the code in main


// Write a program that copies the data in the

// prelab input file to an output file "88_mph"

// so that it is formatted the same in both files.

// Additionally add 50 to the year when you rewrite

// it to the output file to help Marty Mcfly get back to

// his proper time.

#include <iostream>

#include <fstream>

using namespace std;

int main() {

   // ADD HERE declare variables

   

   // declare input file stream variable and open file

   ifstream fin;

   fin.open("prelab_input.txt");

 

   if (!fin) {

     cout << "ERROR - File failed to open. make sure that " << "the input file and this file are in the"

       << "same directory" << endl;

     return -1;

    

   }

   // declare output file stream varaible and open file

   ofstream fout;

   fout.open("88_mph.txt");

   // ADD HERE write your code here

 

   // closing files

   fin.close();

   fout.close();

   return 0;

}


how to remove unwanted space out of your answer?

i did a coding just like the one above but they are saying i have unwanted space in my output.


Mr Caleb the Hoc of 200 level computer science in Caleb university bought the following goods in one of the warehouse in Lagos where prices of these goods or products are displayed exclusive



*One bag of rice @ 30,000.00 naira



*A 25 litre of groundnut oil @15,000 naira each



*50kg of beef @5,000 naira each



a)Write a C++ program to find the total amount paid by Caleb HOC if VAT was charged @17.5%



b)What is the total Expenditure of HOC is transportation cost was put @4,500.00 naria

Write a program that deletes duplicate elements from a queue.



Requirements:


No global decelerations


Test run the code in main

(a) 

Describe an algorithm that sorts an input array A[1 · · · n] by calling a subroutine

SQRTSORT(k), which sorts the subarray A[k + 1 · · · k +√n] in place, given an arbitrary integer k between 0 and n −√n as input. (To simplify the problem, assume that √n is an integer.) Your algorithm is only allowed to inspect or modify the input array by calling SQRTSORT; in particular, your algorithm must not directly compare, move or copy array elements.

How many times does your algorithm call SQRTSORT in the worst case? Give pseudocode. You cannot use anything other than calling the SQRTSORT routine and maybe some loops. But write a few sentences justifying your approach.


(b)

Prove that your algorithm from part (a) is optimal up to constant factors. In

other words, if f(n) is the number of times your algorithm calls SQRTSORT, prove that no

algorithm can sort using o(f(n)) calls to SQRTSORT. We are assuming that

these algorithms cannot do anything other than calling SQRTSORT repeatedly.




Let n = 2^l − 1 l for some positive integer l. Suppose someone claims to hold an unsorted array A[1 · · · n] of distinct l-bit strings; thus, exactly one l-bit string does not appear in A. Suppose further that the only way we can access A is by calling the function

FETCHBIT(i, j), which returns the jth bit of the string A[i] in O(1) time. Describe an algorithm to find the missing string in A using only O(n) calls to FETCHBIT. Again, give either pseucode or write a generic description.

Demonstrating the algorithm on a specific example will not fetch any marks.


Create a base class called Vehicle. Use this class to store two double type values that could be used to compute

the speed of the vehicle. Derive two specific classes called train and truck from the base Vehicle. Add to base

class, a member function get_speed() to initialize base class data members and another member functions

get_name() to compute and display the area of figures. Mark the display_area() as a abstract function and redefine

this function in the derived class to suit their requirements.


Develop a university payroll application. There are two kinds of internee in the university salaried internee, hourly

internee. The system takes as input an array containing internee objects, calculates no.of days spent in the

university polymorphically, and generates results.


Write a program that declares two classes. The parent class is called Shape that has two data members num1 and num2 to store two numbers. It also has four members functions.

·        The setarea() function set the area and displays the result.

·        The getarea() function get the area and displays the result.

·        The setdraw() function set the coordinates for draw and displays the result.

·        The getdraw() function get the coordinates for draw and displays the result.

The child class is called Circle that overrides all four functions. Each function in the child class checks the value of data members. It calls the corresponding member function in the parent class if the values are greater than 0. Otherwise it displays error message. All the possible exception is handle through exception handling.



LATEST TUTORIALS
APPROVED BY CLIENTS