0% found this document useful (0 votes)
17 views3 pages

Complex Computing Problem

some good practice questions for analyses of algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

Complex Computing Problem

some good practice questions for analyses of algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Complex Computing Problem

Q1: Consider the following arithmetic series and Find out O(g(n)), Ω (g(n)),Θ( g(n ))

Q2: Consider the following quadratic series and Find out O(g(n)), Ω (g(n)),Θ( g(n ))

Q 3: Consider the following geometric series and Find out O(g(n)), Ω (g(n)),Θ( g(n ))

Q 4: Consider the following Harmonric series and Find out O(g(n)), Ω (g(n)),Θ( g(n ))

Q 5: The following proposition is about the merge sort. Prove it by the induction method.
If D (N) satisfies D (N) = 2 D (N / 2) + N for N > 1, with D (1) = 0, then D (N) = N lg N.

Q 6: Although merge sort runs in worst-case time and insertion sort runs in
worst-case time, the constant factors in insertion sort can make it faster in practice for small
problem sizes on many machines. Prove merge sort cost by recursion tree method.

Q 7: Merge sort is implemented in Java by making auxiliary array. Discuss how the code could
be practically improved.

Q 8: Discuss the scientific method applicable for the analysis of algorithms. List which system
dependent and system independent factors are considered during the analysis.

Q 9: Write down Java code for N distinct integers, to count how many triples sum to exactly
zero? And perform its analysis.

Q 10: Discuss the common order of growth of algorithms considering constant, logarithmic,
linear, linearithmic, quadratic, cubic, and exponential rates with examples.

Q 11: Binary search uses at most 1 + lg N key compares to search in a sorted array of size N.
Prove it by recurrence method.
Q 12: Write down a Java code to implement Selection sort for N integers, which consists of
Comparable interface, less() and exch() methods. Perform its mathematical analysis in terms of
the number of comparisons and exchanges.

Q 13: Write a Java code to implement Insertion sort for N integers, consisting of Comparable
interface, less() and exch() methods. Perform its mathematical analysis in terms of the number of
comparisons and exchanges.

Q 14: Write a Java code to implement Shell sort for N integers, consisting of Comparable
interface, less() and exch() methods. Perform its mathematical analysis in terms of the number of
comparisons and exchanges.

Q 15: Write a Java code to build a symbol Table by associating value i with ith string from
standard input.

Q 16: Compare the order of growth of the running time for ordered symbol table operations in
sequential search and binary search.

Q 17: Implement a stack using a singly linked list in Java. The operations PUSH and POP take a
constant time in the worst case. Calculate how many bytes are occupied per stack node.

Q 18: Implement a Queue using a singly linked list in Java. The operations ENQUEUE and
DEQUEUE take a constant time in the worst case. Calculate how many bytes are occupied per
queue node.

Q 19: Discuss the concept of stack resizing array implementation (grow and shrink concept), its
performance analysis, and memory usage.

Q 20. Discuss the concept of Queue resizing array implementation (grow and shrink concept), its
performance analysis, and memory usage.

Q 21. Write a Java code to build a generic stack using a linked list and another program to build
a generic stack using an array.

Q 22: Discuss which sorting types are Stable by building Java code.

Q 23. What is the benefit of using the Iterable interface in a stack using a singly linked list in
Java? Explain with an example.

Q 24. What is the benefit of using the Iterable interface in a stack using an array in Java? Explain
with an example.

Q 25. Write a Java code to implement a two-stack algorithm for an arithmetic expression. One
stack will be used for values and another for operators. The left parenthesis is ignored. When a
right parenthesis is encountered, then pop the operator and the two values, push the result after
applying that operator to the values stack.
Q 26. The following code performs shuffling using Uniform(), explain the difference if it is
replaced by random().

public class StdRandom


{
...
public static void shuffle(Object[] a)
{
int N = a.length;
for (int i = 0; i < N; i++)
{
int r = StdRandom.uniform(i + 1);
exch(a, i, r);
}
}
}

Q27: Prove the correctness of the algorithm for finding the maximum element of an array by the
induction method.
Q 28: Prove the correctness of the algorithm for finding the sum of elements of an array by the
induction method.

Q 29: Prove the recurrence equation of 0the Tower of Hanoi by the repeated substitution method.

Q 30: Guess the solution of the Tower of Hanoi and prove it by the induction method.

You might also like