Other Programming & Computer Science Answers

Questions: 1 727

Answers by our Experts: 1 357

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

R-8.1: The following questions refer to the tree of Figure 8.3 ( http://postimg.org/image/xwijnajxj/ ) in the textbook Data Structures and
Algorithms in Java (Sixth Edition) Goodrich, Tamassia and Goldwasser
1. Which node is the root?
2. What are the internal nodes?
3. How many descendants does node sc016/ have?
4. How many ancestors does node sc016/ have?
5. What are the siblings of node homeworks/?
6. Which nodes are in the subtree rooted at node projects/?
7. What is the depth of node papers/?
8. What is the height of the tree?
The Birthday Problem: The birthday problem is stated as follows:
If there is a group of n people in a room, what is the probability that two or more of them having same birthday? It is possible to determine answer to this question by simulation. (Hint: You can generate random dates, n times and determine the fraction of people who born in a given day). Write a function that determines the answer to this question by simulation. The program you write can take n as the input and prints out the probability that two or more of n people will have the same birthday for n=2,3,4…. 40
Suppose we have TEGRA, a multi-core mobile processor. While writing an application in assembly language for the given device, we have two options regarding code optimization.

Option A: Do necessary optimization steps before and then write the code.

Option B: First code the program in a normal way and then make necessary changes in order to optimize it.

Can we prefer any approach over the other or both are acceptable. Justify your answer with logical reasoning.
1. Suppose an initially empty stack S has performed a total of 25 push operations, 12 top operations, and 10 pop operations, 3 of which returned null to indicate an empty stack. What is the current size of S?

2. Suppose an initally empty queue Q has performed a total of 32 enqueue operations, 10 first operations, and 15 dequeue operations, 5 of which returned null to indicate an empty queue. What is the current size of Q?
In the Byteland country a string "S" is said to super ascii string if and only if count of each character in the string is equal to its ascii value.

In the Byteland country ascii code of 'a' is 1, 'b' is 2 ...'z' is 26.

Your task is to find out whether the given string is a super ascii string or not.
Input Format:

First line contains number of test cases T, followed by T lines, each containing a string "S".

Output Format:

For each test case print "Yes" if the String "S" is super ascii, else print "No"

Constraints:
1<=T<=100

1<=|S|<=400, S will contains only lower case alphabets ('a'-'z').


Sample Input and Output

SNo. Input Output
1
2
bba
scca


Yes
No
Expert's answer
Given a Fibonacci sequence (http://en.wikipedia.org/wiki/Fibonacci_number), start cancelling every Lth element. Wrap around and continue the cancellation until only one element remains. As the Fibonacci number will overflow in a traditional data type, take modulus of the number with 1000000007.
Design an ER diagram for the following situation:

An organization has two types of employees, salaried and wage earning. Both the types of
employees have some common properties, such as employee code, employee name, and
employee address. However, the salaried employees have other additional properties: basic,
allowance, and House Rent Allowance (HRA). The wage earning employees have distinct
properties that are daily wage and overtime.
In the Byteland country a string "S" is said to super ascii string if and only if count of each character in the string is equal to its ascii value.

In the Byteland country ascii code of 'a' is 1, 'b' is 2 ...'z' is 26.

Your task is to find out whether the given string is a super ascii string or not.
Input Format:

First line contains number of test cases T, followed by T lines, each containing a string "S".
Output Format:

For each test case print "Yes" if the String "S" is super ascii, else print "No"
Constraints:
1<=T<=100
1<=|S|<=400, S will contains only lower case alphabets ('a'-'z').

Sample Input and Output
SNo. Input Output
1
2
bba
scca
Yes
No

Explanation:

In case 1, viz. String "bba" -
The count of character 'b' is 2. Ascii value of 'b' is also 2.
The count of character 'a' is 1. Ascii value of 'a' is also 1.
Hence string "bba" is super ascii.
I am doing a newsletter which has to be responsive in desktop outlook, in mobile and in Tablet. I can't able to make image responsive in the emailer. Please advice at the earliest.
1. Describe a recursive algorithm for finding the maximum element in an array A of n elements. What
is the running time of your algorithm?

2. Draw the recursion trace for the execution of reverseArray(data, 0, 4), on the array data = 4, 3, 6, 2, 6.

3. Give an algorithm for finding the second-to-last node in a singly-linked list ub which the last node is
indicated by a null next reference.

4. Suppose we are maintaining a collection C of elements such that, each time we add a new element
to the collection, we copy the contents of C into a new array list of just the right size. What is the
running time of adding n elements to an initially empty collection C in this case?
LATEST TUTORIALS
APPROVED BY CLIENTS