Searching for the largest area of equal elements in a matrix using BFS/DFS hybrid algorithm

Several weeks ago I was faced with the following task:
Write a program that finds the largest area of equal neighbor elements in a rectangular matrix and prints its size. Example:
table
It was hinted that Breadth first or Depth first search algorithms would be able to solve this problem. However, I was feeling way too lazy to be bothered with reading about those so I just decided to solve the problem “my way”. Continue reading “Searching for the largest area of equal elements in a matrix using BFS/DFS hybrid algorithm”

Algorithms: Binary search explanation and C# implementation

prog
Binary search is one of the most basic yet very useful algorithms. It can operate on sorted arrays or range of values. Some people consider it divide and conquer algorithm, others don`t, but it does not really matter. The goal of binary search is to find a specified value (or its index) within an array or a range of values, it can also be used to search for a unknown value which must meet certain known conditions.
Continue reading “Algorithms: Binary search explanation and C# implementation”

Converting numeric Char to Int in C#

Several days ago, in a programming problem I was solving, the easy task of converting a numeric character to an integer was standing before me. Yes, doing such conversion is easy, but I was shocked that although having experience with programming, this was the very first time I had to do such conversion. So here are the results of my research on this “problem”.
Continue reading “Converting numeric Char to Int in C#”