Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

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

 Write a proper program to perform any operation on jagged array{java}


 Write a program to count the number of occurrences of each character in a string and store that number in an array.{java code}


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

Problem 3: A multi-graph is a graph which may have more than one edge (parallel edges) between a pair of vertices. Suppose that these graphs may also have self-loops (an edge from a vertex to itself). Given such a graph G as an input, print the adjacency list representation of an equivalent undirected graph G’, in which all the multiple edges between two vertices are replaced by a single edge, and all self-loops are removed. Your algorithm should run in O(n+m) time. Input Format: The input is a text file which gives the adjacency list representation of the multigraph. The first line specifies the number of vertices and edges n and m. The next m lines specify the m edges, one edge per line. Assume the vertices are numbered 0 to n-1.

Output Format: The adjacency list representation of the new graph G’.

Sample Input (for the graph above): 3 6

0 0

0 2

2 2

0 2

0 2

0 1

Sample Output: Adjacency list representation of G’: 0: 1 2 1: 0 2: 0


 Given an input undirected graph, create and print the adjacency list and adjacency matrix representations of the graph. Input Format: The input is a text file which describes an undirected graph. The first line of the file specifies n & m, the number of vertices and number of edges in the graph respectively. The next m lines specify the m edges of the graph, one line per edge. An edge is described by its end points. If the number of vertices is n, assume that the vertices of the graph are numbered (0,1,..n-1). Output Format: Print the adjacency list and adjacency matrix representation of the graph. In the adjacency list representation, for a given vertex, the order of its adjacent vertices does not matter.


Design a 'book' class with title, author,publisher, price and author's royalty as instance variables. Provide getter and setter properties for all variables. Also define a method royalty() to calculate royalty amount author can expect to receive the following royalties :10% of the retail price on the first 500 copies ;12.5% for the next, 1000 copies sold, then 15% for all further other copies sold


Write a program that deletes duplicate elements from a queue.



Requirements:


No global decelerations


Test run the code in main

The following code is supposed to take input from the user and print out each entry and add them together with a final print out of the total of all input numbers. The code does exactly that, but I don't get how it prints each input without the writeline being inside the loop. If I move the writeline into the loop, it double prints the input. Any help understanding this would be greatly appreciated. Thanks


Sub Main()

    Dim sum As Integer

    Dim inValue As Integer

    Console.WriteLine("Enter a number: ")


    Do

      inValue = Console.ReadLine()

      If inValue <> -1 Then

        sum += inValue

      End If

    Loop Until inValue = -1


    Console.WriteLine(sum)


    Console.WriteLine("press enter to exit")

    Console.ReadLine()

  End Sub


(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.


LATEST TUTORIALS
APPROVED BY CLIENTS