Binary Search Algorithm

Another algorithm to search in data structures as like Linear Algorithm . As compared to Linear search, Binary search is more efficient and faster. Linear Algorithm will make performance issue, if the array length is huge. How it works? Sort input arrayIdentify the middle index of the input arrayCheck the element at middle index with … Continue reading Binary Search Algorithm

Linear Search Algorithm

Linear Search algorithm is used to search for an item in any data structures like - Array, Linked List, Queue etc. How it works ? Start searching for a given element from starting index in a arrayIf the element found in array return the valueIf not found return -1 Let's look into an example. We … Continue reading Linear Search Algorithm

Liskov’s Substitution Principle

This is the third Design Principle which states that,  if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program[Wikipedia]. Lets check the code without LSP concept. class Training { public int TrainingID { get; set; } public string Name { get; set; } … Continue reading Liskov’s Substitution Principle

Single Responsibility Principle (SRP)

This is the first Design Principle which  states that, a class should take one responsibility and there should be only one reason to change the class. Let's understand with an example.  class Training { public int TrainingID { get; set; } public string Name { get; set; } public string Venue { get; set; } } class … Continue reading Single Responsibility Principle (SRP)