Category: 03. Functions & Algorithms

  • Algorithms and Functions

    Characteristics of Algorithms: Algorithms generally have the following characteristics: Analysis (Complexity) of Algorithms The Analysis of an algorithm refers to the process of deriving estimates for the time and space needed to execute the algorithm. It is important to estimate the time (e.g., the number of steps) and space (e.g., the number of variables) required…

  • Mathematical Functions

    The following are the functions which are widely used in computer science. 1. Floor Functions: The floor function for any real number x is defined as f (x) is the greatest integer 1 less than or equal to x. It is denoted by [x]. Example: Determine the value of (i)[3. 5]       (ii)[-2.4]       (iii)[3.…

  • Compositions of Functions

    Consider functions, f: A → B and g: B → C. The composition of f with g is a function from A into C defined by (gof) (x) = g [f(x)] and is defined by gof.       To find the composition of f and g, first find the image of x under f…

  • Identity Functions

    The function f is called the identity function if each element of set A has an image on itself i.e. f (a) = a ∀ a ∈ A. It is denoted by I. Example: The function f is an identity function as each element of A is mapped onto itself. The function f is a…

  • Types of Functions

    Injective (One-to-One) Functions: A function in which one element of Domain Set is connected to one element of Co-Domain Set. 2. Surjective (Onto) Functions: A function in which every element of Co-Domain Set has one pre-image. Example: Consider, A = {1, 2, 3, 4}, B = {a, b, c} and f = {(1, b), (2, a), (3, c),…

  • Functions as a Set

    If P and Q are two non-empty sets, then a function f from P to Q is a subset of P x Q, with two important restrictions Note1: There may be some elements of the Q which are not related to any element of set P. 2. Every element of P must be related with…

  • Functions

    It is a mapping in which every element of set A is uniquely associated at the element with set B. The set of A is called Domain of a function and set of B is called Co domain. Domain, Co-Domain, and Range of a Function: Domain of a Function: Let f be a function from P…