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
Q. Explain Dijkstra's algorithm for finding the shortest path in the graph given to us.  Ans: The Dijkstra's algorithm: This is a problem which is concerned with finding

Game trees An interesting application of trees is the playing of games such as tie-tac-toe, chess, nim, kalam, chess, go etc. We can picture the sequence of possible moves by m

What are stacks? A stack is a data structure that organizes data similar to how one organizes a pile of coins. The new coin is always placed on the top and the oldest is on the

Preconditions assertion A precondition is an assertion which should be true at the initiation of an operation. For instance, a square root operation can't accept a negative a

P os t - o r d e r T r av er sal :  This can be done by both iteratively and recursively. The iterative solution would require a modification or alteration of the in-

Illustrate the Visual realism applications a)   Robot Simulations : Visualization of movement of their links and joints  and end effector movement etc. b)  CNC programs ver

Define Prim's Algorithm Prim's  algorithm  is  a  greedy  algorithm  for  constructing  a  minimum  spanning  tree  of  a  weighted linked graph. It works by attaching to a bef

Task If quicksort is so quick, why bother with anything else? If bubble sort is so bad, why even mention it? For that matter, why are there so many sorting algorithms? Your

In a doubly linked list, also called as 2 way list, each node is divided into 3 parts. The first part is called previous pointer field. It contains the address of the preceding

Time Complexity:- The time complexity of an algorithm is the amount of time it requires to run to completion. Some of the reasons for studying time complexity are:- We may be in