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
Ask consider the file name cars.text each line in the file contains information about a car ( year,company,manufacture,model name,type) 1-read the file 2-add each car which is repr

The searching technique that takes O (1) time to find a data is    Hashing is used to find a data

Which sorting algorithm is best if the list is already sorted? Why? Insertion sort as there is no movement of data if the list is already sorted and complexity is of the order

Q. Assume that we have separated n elements in to m sorted lists. Explain how to generate a single sorted list of all n elements in time O (n log m )?

What data structure would you mostly likely see in a nonrecursive execution of a recursive algorithm? Stack

Explain the theory of computational complexity A  problem's  intractability  remains  the  similar  for  all  principal  models  of   computations    and   all reasonable inpu

Write a program to create a hashed file that stores the records currently in the file " data_2013 ". Records should use the same fixed-length schema given previously, and should ag

Range: A Structured Type in Ruby Ruby has a numerous structured types, comprising arrays, hashes, sets, classes, streams, and ranges. In this section we would only discuss rang

how to learn about time complexity of a particular algorithm

What do you mean by hash clash? Hashing is not perfect. Occasionally, a collision occurs when two different keys hash into the same hash value and are assigned to the same arra