Skip to content

A static C++ library containing basic algorithms.

Notifications You must be signed in to change notification settings

PJayakrishnan/AlgoLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlgoLib

A static C++ library contatining basic algorithms.

Content:

How to compile the library

You can clone this github repo to your local system using Visual Studio and open the .sln file there. Thus you will be able to compile and build AlgoLib project to .lib file.

How to add AlgoLib library in your project using Visual Studio

You can copy the required .h and .lib files to a folder inside the project you want this library to serve for and give both the file's relative paths in project properties at respective locations.

You can add header file like,

#include "../include/SearchingAlgos.h"

when it is placed inside a folder, say include in the project directory.

SearchingAlgos

Functions

1. LinearSearch


  Function   : LinearSearch
  Parameters : (4) - array, length of array, element to be searched,
  		reference to duration to complete algorithm
  Retrun type: Position of element to be searched in the given array
  Note       : If the given elemet to be searched is not found, method
               will return -1. Array and elemnt to be searched should
               be of integers.

To use this method:

int position = AlgoLib::SearchingAlgos::LinearSearch(array, length, elementToBeSearched, duration);

Note: duration is passed as reference and can be used further down the code when it have the time taken to complete the algorithm, in milli seconds.

Time complexity : O(n)
Auxiliary Space : O(1)

2. BinarySearch


  Function   : BinarySearch
  Parameters : (4) - array, length of array, element to be searched, 
  		reference to duration to complete algorithm.
  Retrun type: Position of element to be searched in the given array
  Note       : If the given elemet to be searched is not found, method
               will return -1. Array and elemnt to be searched should
               be of integers and array should be sorted.

To use this method:

int position = AlgoLib::SearchingAlgos::BinarySearch(array, length, elementToBeSearched, duration);

Note: duration is passed as reference and can be used further down the code when it have the time taken to complete the algorithm, in milli seconds.

Time complexity : O(logn)
Auxiliary Space : O(1)

SortingAlgos

Functions

1. SelectionSort


  Function   : SelectionSort
  Parameters : (3) - array, length of array,
  		reference to duration for 
  		sorting.
  Retrun type: void
  Note       : Array should be of integers.
  

To use this method:

int position = AlgoLib::SortingAlgos::SelectionSort(array, length, duration);
Time complexity : O( $n^2$ )
Auxiliary Space : O(1)

Releases

No releases published

Packages

No packages published

Languages