Skip to content

Latest commit

 

History

History

search_algorithms

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

C - Search Algorithms

Description

  • tests/ - Main functions provided by Holberton School to test the files.
  • search_algos.h - Header file with function prototypes and with libraries.

Tasks

  • 0. Linear search
  • 1. Binary search
  • 2. Big O #0
    • 2-O - Time complexity (worst case) of a linear search in an array of size n.
  • 3. Big O #1
    • 3-O - Space complexity (worst case) of an iterative linear search algorithm in an array of size n.
  • 4. Big O #2
    • 4-O - Time complexity (worst case) of a binary search in an array of size n.
  • 5. Big O #3
    • 5-O - Space complexity (worst case) of a binary search in an array of size n.
  • 6. Big O #4
    • 6-O - Space complexity of this function/algorithm:
  int **allocate_map(int n, int m)
  {
    int **map;

    map = malloc(sizeof(int *) * n);
    for (size_t i = 0; i < n; i++)
    {
        map[i] = malloc(sizeof(int) * m);
    }
    return (map);
  }
  • 7. Jump search
  • 8. Big O #5
    • 101-O - Time complexity (average case) of a jump search in an array of size n, using step = sqrt(n).

Author