November 05, 2018

Design and Analysis of Algorithms - Mid Sem Solution


Question 1A)
The time factor when determining the efficiency of algorithm is measured by
a) Counting microseconds
b) Counting the number of key operations
c) Counting the number of statements
d) Counting the kilobytes of algorithm

Answer: b
Justification: It is hardware and language independent , rest are dependent on hardware or on software

1B) The concept of order Big O is important because
a) It can be used to decide the best algorithm that solves a given problem
b) It determines the maximum size of a problem that can be solved in a given  amount of time
c) It is the lower bound of the growth rate of algorithm
d) Both A and B

Answer: a
Justification: We know that Big Oh notation is used in time complexity . the reason why we called Big Oh because it says "at any condition this is worst time that an algorithm could take " where as Big Omega says its is "best time that you can get , You cant get better than this.

1C) In worst case Quick Sort has order
A) O (n log n)            B. O (n2 /2)                C. O (log n)                         D. O (n2 /4)

Answer: A
Justification: In the worst case of quick sort has order O(n2). Quick sort is the quickest comparison-based sorting algorithm. It is very fast and requires less additional space, only O(n log n) space is required.

1D) Consider the following program segment. What is the Space complexity?
Begin
i=0;
S=0;
S=s+1;
Return s;
End

Answer: [If i,S considered as integers] => Space Complexity = 4 +(4*2)  = 12 bytes, where additional 4 bytes is for return value

To calculate the Space complexity of an algorithm, we need to follow the below instruction first:
It is the amount of memory used by the algorithm (including the input values to the algorithm) to execute and produce the result.

Space Complexity = Auxiliary Space + Input space

Calculating the Space Complexity:

For calculating the space complexity, we need to know the value of memory used by different type of datatype variables, which generally varies for different operating systems, but the method for calculating the space complexity remains the same.
TypeSize
bool, char, unsigned char, signed char1 byte
short, unsigned short,2 bytes
float, int, unsigned int, long, unsigned long4 bytes
double, long double, long long8 bytes
1E)  What is the time complexity of optimal binary search
(1) a)O(n) b) O(1) c)O(2n/2 d) O(n2)

Answer: d
Justification:
An optimal binary search tree is a binary search tree for which the nodes are arranged on levels such that the tree cost is minimum.

For Reference:
The complexity of linear search algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)

Answer: a
Justification: It refers to n values complexity in the algorithm which can be reduced by choosing the other algorithms.

The complexity of Bubble sort algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)

Answer: c
Justification: Bubble sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.

Question
Randomised algorithms are also called as __________________ and whose behavior is dependent  on  _______________ in decision making as part of its logic

Answer: probabilistic algorithm and randomness

Question:
Match the following    


Problem

Recurrence Equation
1
Binary Search 
A
tn – tn-1 = 1
2
Merge Sort
B
T(n)=2T(n/2)+n-1
3
Sequential Search
C
tn =  tn-1 + n
4
Factorial
D
T(n)=7T(n/2)+18(n/2)2
5
Strassen Matrix Multiplication
E
T(n)=T(n/2)+1
6
Selection Sort
F
T(n)=T(n/2)+n-1









Answer:

T(n) = Time Complexity
 

Problem

Recurrence Equation
1
Binary Search
E
T(n)=T(n/2)+1
2
Merge Sort
B
T(n)=2T(n/2)+n-1
3
Sequential Search
A
tn – tn-1 = 1
4
Factorial
F
T(n)=T(n/2)+n-1
5
Strassen Matrix Multiplication
D
T(n)=7T(n/2)+18(n/2)2
6
Selection Sort
C
tn =  tn-1 + n

Additional Reference:


7
Insertion sort
-
T(N) = T(N-1) + N-1
8
Tree traversal
-
T(n) = 2T(n/2) + 1
9
Quicksort
-
(n) = 2T(n/2) + n
10
Master Theorm
-
T(n)=aT(n/b)+f(n)












Tip:
Merge Sort: The merge sort algorithm deals with the problem of sorting a list of n elements. It is able to sort a list of n elements in O(n log n) run-time, which is considerably faster than insertion sort, which takes O(n2).
Merge sort uses a divide and conquer method:
1. If the length of the list is 1, the list is sorted. Return the list.
2. Otherwise, split the list in two (roughly) equal halves and then recursively merge sort the two halves
3. Merge the two sorted halves into one sorted list.

November 03, 2018

SOFTWARE PROJECT MANAGEMENT - Mid Sem Solutions

Mid-Sem Paper Solutions:

Note: Provide justification for your choice; else you will get zero, More than one choice may be the right answer.



Question:
When using Agile methods, planning is usually done based on:
A.    Scheduled Milestones                   B. Series of Releases
C.    Fixed Requirements                      D. Technical feasibility

Answer: B
Series of Releases

Justification:
AGILE methodology is a practice that promotes continuous iteration of development and testing throughout the software development life-cycle of the project. In Agile Planning, Selection of features develops during a specific set of time(The sprint).

Basically, in an Agile Project - release plan is focused on planning multiple iterations in an effort to determine when each release will be delivered. In order to achieve the product vision,

Tip: There are lots of reasons which you can use here, the basis on your work. If you have worked in an agile project. 

Question:
All of the following statements concerning stakeholders are true except
A.    Differences between or among stakeholders should be resolved in favor of the customer.
B.    Managing stakeholder expectations may be difficult because stakeholders often have very different objectives that may come into conflict.
C.    Project stakeholders may influence the course of the project and its results.
D.    Differences between or among stakeholders should be resolved in the most cost-efficient manner consistent with project objectives.

Answer: D
Differences between or among stakeholders should be resolved in the most cost-efficient manner consistent with project objectives.


Question:
During a company event, you had the opportunity to talk to a colleague project manager. He told you that in his current project actual costs are15% under cumulated costs scheduled for today. What do you think?
A.    The information available is not sufficient to assess project performance.
B.    The project will probably be completed with total costs remaining under budget.
C.    A significant cost increase during the further course of the project will probably bring the costs back to the baseline level.
D.    Original cost planning must have been poor to allow this variance.

Answer: A
The information available is not sufficient to assess project performance.

November 02, 2018

Software Engineering - Comprehensive

 2015 - 2016
Comprehensive Examination (Regular) 

Question) Indicate True or False for following statements with a justification within 30 words. No credit is given for answers with no justification.  

a. For successful design, you must practice diversification followed by convergence.
Answer)TRUE
b. Appraisal cost is likely to be the most expensive element of cost of quality.
Answer)TRUE
c. Before an architectural pattern is chosen for use in a particular system it must have a code implementation to expedite its reuse.
Answer)FALSE
d.Quantitative methods for evaluating the quality of proposed architectural designs are freely available.
Answer) FALSE
e. In component-based software engineering, the team searches for available components at the outset of the project.
Answer)FALSE
f. With thorough testing it is possible to remove all defects from a program prior to delivery to the customer.
Answer)FALSE
g. Many software metrics can only be measured indirectly.
Answer)TRUE
h. Software testing is deemed complete at end of budgeted duration for testing.
 Answer)FALSE
i. Design patterns are not applicable to the design of object-oriented software.
Answer)FALSE

Question) Differentiate the following: 
a. Analysis vs. design

November 01, 2018

DESIGN AND ANALYSIS OF ALGORITHMS - Comprehensive Paper Solution

Question:
Assume that there are two algorithms A and B for a given problem P. The time complexity functions of algorithms A and B are 5n and log2n    respectively. Which algorithm should be selected assuming that all other conditions remain the same for both the algorithms?

Solution:
Assuming that all conditions remain the same for both algorithms, the best algorithm takes less time when the input is changed to a larger value. Results obtained employing different values of n are shown below:

Computer Networks - Answer Key

QUESTION 1.For each of the following applications,  determine whether  TCP or UDP is used as the transport layer protocol  and explain the reason(s) for your choice [5 x 2 = 10]
a)File Transfer
b)Watching a real time streamed video
c)Web browsing
d)A Voice over IP (VoIP) telephone conversation

Solution
a)File transfer :This should be TCP The reason is that you want a file to be transmitted in its entirety without any errors, therefore the error detection and correction properties of TCP are needed.
b)Watching a real time streamed video :This should be UDP. The reason is that when watching a movie, delay is critical and therefore there simply isn't any time to seek the retransmission of any errors. The simplicity of UDP is therefore required.
c)Web browsing :This should be TCP The reason is that web pages need to be delivered without error so that all content is properly formatted and presented. Therefore the error detection and correction properties of TCP are needed.
d)A Voice over IP (VoIP) telephone conversation :This should be UDP. The reason is that a telephone conversation has strict timing requirements for the transfer of data and seeking the retransmission of any errors would introduce too much delay. Therefore the simplicity of UDP is needed.