If-then-else statements, Data Structure & Algorithms

In this example, suppose the statements are simple unless illustrious otherwise. if-then-else statements

if (cond) {

sequence of statements 1

}

else {

sequence of statements 2

}

In this, if-else statement, either sequence 1 will execute, or sequence 2 will execute based on the Boolean condition. In this case the worst-case time is the slower of the two possibilities. For instance, if sequence 1 is O(N2) and sequence 2 is O(1), then the worst-case time for the whole if-then-else statement would be O(N2).

Posted Date: 4/4/2013 5:55:18 AM | Location : United States







Related Discussions:- If-then-else statements, Assignment Help, Ask Question on If-then-else statements, Get Answer, Expert's Help, If-then-else statements Discussions

Write discussion on If-then-else statements
Your posts are moderated
Related Questions
the voltage wave forms are applied at the inputs of an EX-OR gate. determine the output wave form

The number of interchanges needed to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is 5

This section prescribes additional exercise with the recursive and iterative handling of a binary search tree. Adding to the Binary Search Tree Recursively Add implementation

Generally, Computational complexity of algorithms are referred to through space complexity (space needed for running program) and time complexity (time needed for running the progr

Do you have a library solution for this problem?

A common person's faith is that a computer can do anything. It is far from truth. In realism computer can carry out only definite predefined instructions. The formal illustration o

How do you find the complexity of an algorithm?  Complexity of an algorithm is the measure of analysis of algorithm. Analyzing an algorithm means predicting the resources that

Question 1 Explain the use of algorithms in computing Question 2 Explain time complexity and space complexity of an algorithm Question 3 Explain how you can analyz

This algorithm inputs number of hours of sunshine recorded every day for a week (7 days). Output is the highest value for hours of sunshine and average (mean) value for numbers of

write an algorithm and draw a flowchart to calculate the perimeter and area of a circle