Learn how to check if a line segment intersects with a rectangle.

### Also find me here:

# Baeldung Author

## Milos Simic

I'm a Ph.D. student in AI at the University of Belgrade. My fields of interest are machine learning, search, statistics, and data analysis. I have a strong background in programming and algorithms in general, always looking for new challenges.

## Here's what I've written (so far):

## Baeldung on Computer Science

- All
- Math and Logic (16)
- Algorithms (14)
- Machine Learning (10)
- Trees (9)
- Sorting (9)
- Programming (9)
- Graph Traversal (8)
- Searching (5)
- Data Structures (4)
- Path Finding (3)
- Deep Learning (3)
- Artificial Intelligence (3)
- Latex (2)
- Graphs (2)
- Data Science (2)
- Security (1)
- Graph Theory (1)

### Isomorphic Trees

Filed under Algorithms, Trees

Learn how to check if two trees are isomorphic.

### The Centers of Unweighted Trees

Filed under Algorithms, Trees

Learn about the centers of unweighted trees.

### Shuffling an Array

Filed under Algorithms

Learn how to shuffle an array efficiently.

### The 3Sum Problem

Filed under Math and Logic, Programming

Learn about two solutions to the integer 3Sum problem.

### Statistical Independence

Filed under Math and Logic

Explore statistical independence or events and random variables.

### Bayes’ Theorem

Filed under Math and Logic

Explore Bayes’ theorem.

### Linear Search With Fewer Comparisons

Filed under Searching

Explore an improved version of linear search.

### Finding the Digital Root

Filed under Math and Logic

Explore two ways to calculate the digital root of an integer.

### Random Variables

Filed under Math and Logic

Learn more about the random variables.

### How to Get Bold Math Symbols in Latex

Filed under Latex

Explore bolding math symbols in Latex.

### Parameters vs. Hyperparameters

Filed under Machine Learning

Explore the difference between the parameters and hyperparameters in machine learning.

### Finding Neighbors of a Matrix Cell

Filed under Math and Logic, Programming

Learn how to find neighbors of a cell in a 2D matrix.

### Referencing Subordinate Equations in LaTeX

Filed under Latex

Learn how to reference subordinate equations in LaTeX and customize their labels.

### Differences Between Definition, Declaration, and Initialization

Filed under Programming

Discuss declarations, definitions, and initialization in programming.

### How to Project a 3D Point onto a 2D Plane?

Filed under Math and Logic

Learn how to project a point onto a plane and find its coordinates in the plane’s coordinate system.

### The Complexity of Shellsort

Filed under Sorting

Explore Shellsort’s complexity.

### How to Check If a String Is a Palindrome?

Filed under Algorithms

Explore recursive and iterative algorithms for checking if a string is a palindrome.

### From Postfix Expressions to Expression Trees

Filed under Graph Theory

Explore a linear-time algorithm for converting a postfix expression into an expression tree.

### Jump Search Algorithm

Filed under Searching

Learn about the Jump Search algorithm.

### Exponential Search

Filed under Searching

Learn about Exponential Search.

### Sampling From the Exponential Distribution

Filed under Math and Logic

Learn about sampling from an exponential distribution.

### F-Beta Score

Filed under Artificial Intelligence

Learn more about the F-Beta score in machine learning.

### What’s a Hypothesis Space?

Filed under Math and Logic

Learn about hypotheses spaces in machine learning.

### Converting Floats into Fractions

Filed under Math and Logic

Explore four ways of converting a float into a fraction: two exact techniques and two approximate.

### How to Find Common Elements in Two Sorted Arrays

Filed under Sorting

Explore two efficient ways of finding common elements of two sorted arrays.

### Precision vs. Average Precision

Filed under Artificial Intelligence

Explore the differences between precision and average precision.

### How to Calculate the Runtime Percentage Improvement

Filed under Algorithms, Programming

Learn how to compute the percentage improvement when the performance metric is time.

### Binary Search Trees vs. AVL Trees: the Complexity of Construction

Filed under Data Structures, Trees

Explore the construction complexities of Binary Search Trees (BSTs) and AVL trees.

### Pre-increment vs. Post-increment in a Loop

Filed under Programming

Explore the difference between the pre-increment and post-increment operators inside a loop’s termination condition.

### How to Find the Minimum Difference Between Elements in an Array

Filed under Algorithms, Security

Learn how to find the closest two numbers in an array.

### Find the Kth Smallest Element in a Binary Search Tree

Filed under Graph Traversal, Trees

Learn how to find the k-th smallest element in a binary search tree.

### How to Find the Two Points With the Minimal Manhattan Distance

Filed under Algorithms

Learn how to find the closest two points in a two-dimensional space endowed with the Manhattan distance.

### Decision Trees vs. Random Forests

Filed under Machine Learning

Explore the difference between decision trees and random forests.

### What is the Difference Between Artificial Intelligence, Machine Learning, Statistics, and Data Mining?

Filed under Data Science, Machine Learning

Learn about the differences between artificial intelligence, machine learning, statistics, and data mining.

### Difference Between the Cost, Loss, and the Objective Function

Filed under Machine Learning

Explore the meanings of the loss, cost, and objective functions.

### Gradient Boosting Trees vs. Random Forests

Filed under Machine Learning

Learn about the gradient-boosting trees and compared them to random forests.

### Intuition Behind Kernels in Machine Learning

Filed under Deep Learning, Machine Learning

Discuss the role of kernels in machine learning intuitively.

### Information Gain in Machine Learning

Filed under Data Science, Machine Learning

Learn how to calculate the information gain in Data Science and Machine Learning.

### Cross-Validation and Decision Trees

Filed under Artificial Intelligence

Learn about cross-validating decision trees.

### Pseudo-Polynomial vs. Polynomial Complexity

Filed under Algorithms, Math and Logic

Learn about pseudo-polynomial algorithms.

### Is Selection Sort Stable?

Filed under Sorting

Learn about the stability of Selection Sort.

### Number of Comparisons in Straight Selection Sort

Filed under Sorting

Learn how to calculate the number of comparisons in Straight Selection Sort.

### K-Means for Classification

Filed under Machine Learning

Learn how to use K-means for classification.

### Linearly Separable Data in Neural Networks

Filed under Deep Learning, Machine Learning

Learn about linear separability in Machine Learning.

### The Effects of The Depth and Number of Trees in a Random Forest

Filed under Deep Learning, Machine Learning

Explore a methodology for estimating how the depth and number of trees affect the performance of a random forest.

### Radix Sort

Filed under Sorting

Learn about the Radix Sort algorithm.

### The Monty Hall Problem

Filed under Math and Logic

Explore the Monty Hall Problem.

### How to Check String Periodicity

Filed under Algorithms

Explore three algorithms designed to check string periodicity.

### Binary Insertion Sort

Filed under Sorting

Learn about Binary Insertion Sort algorithm and its complexity.

### Tabulation vs. Memoization

Filed under Programming

Explore tabulation and memoization.

### Tree Edit Distance

Filed under Trees

Learn about tree edit distance and how to calculate it.

### Context-Free Languages

Filed under Programming

Learn about context-free languages and some techniques for proving that a language is (not) context-free.

### Balanced Trees

Filed under Data Structures, Trees

Explore three types of balanced trees: the AVL trees, red-black trees, and weight-balanced trees.

### How to Sort Mostly Sorted Arrays

Filed under Sorting

Compare the efficiency of four standard sorting algorithms: Bubble Sort, Insertion Sort, Quicksort, and Merge Sort.

### The Skip List Data Structure

Filed under Data Structures

Explore skip lists and operations of insertion, search, and deletion using the skip list data structure.

### Induced Subgraphs

Filed under Graphs

Learn about induced and ordinary subgraphs.

### Weighted vs. Unweighted Graphs

Filed under Graphs

Learn about the differences between the unweighted and weighted graphs.

### Rank of a Node in a Binary Search Tree

Filed under Graph Traversal, Trees

Explore three ways to determine a node’s rank in a binary search tree.

### Finding the In-Order Successor of a Node

Filed under Graph Traversal, Trees

Explore three ways to find the in-order successor of a node.

### From Lists to Forests

Filed under Data Structures, Trees

Explore two algorithms for building a forest of trees from a flat list.

### From Recursive to Iterative Functions

Filed under Programming

Learn about converting recursion into iteration.

### Streaming Median

Filed under Algorithms, Math and Logic

Explore two algorithms for finding the median of a big data stream.

### Tail vs. Non-Tail Recursion

Filed under Programming

Explore the difference between the tail and non-tail recursion.

### The Akra-Bazzi Method

Filed under Algorithms

Explore the Akra-Bazzi method used to determine the complexity divide-and-conquer algorithms.

### Generating Permutations with Repetition

Filed under Math and Logic

Explore two ways to generate all the permutations with repetition of the set.

### Bidirectional Search for Path Finding

Filed under Path Finding

Learn about two algorithms: Bidirectional Search (BiS) and Bidirectional UCS (BiUCS).

### How to Solve Constraint Satisfaction Problems

Filed under Algorithms

Learn about a general backtracking algorithm for solving constraint satisfaction problems.

### Expectimax Search Algorithm

Filed under Searching

Explore the Expectimax algorithm for stochastic games.

### Dijkstra vs. A* – Pathfinding

Filed under Path Finding

Explore differences between Dijkstra’s and A* algorithms.

### Depth-First Search vs. Breadth-First Search

Filed under Graph Traversal

Compare Depth-First Search (DFS) to Breadth-First Search (BFS).

### Graph Search vs. Tree-Like Search

Filed under Graph Traversal

Compare the Graph-Search and Tree-Like Search strategies.

### Uniform-Cost Search vs. Best-First Search

Filed under Graph Traversal

Explore Uniform-Cost Search (UCS) and Best-First Search (BeFS).

### The Informed Vs. Uninformed Search Algorithms

Filed under Searching

A comparison between informed and uninformed search strategies.

### Finding All Tic-Tac-Toe Winning Combinations

Filed under Algorithms

Learn how to find all the tic-tac-toe grids that represent a win.

### Tracing the Path in DFS, BFS, and Dijkstra’s Algorithm

Filed under Graph Traversal, Path Finding

Explore several ways to trace the paths in Depth-First Search, Breadth-First Search, and Dijkstra’s Algorithm.

### Iterative Deepening vs. Depth-First Search

Filed under Graph Traversal

Learn about the differences between Depth-First Search and Iterative Deepening.

### Complexity Analysis of QuickSelect

Filed under Sorting

Analyze the worst, best, and average-case time complexity of QuickSelect.

### Candidate Elimination Algorithm

Filed under Algorithms

Learn about the Candidate Elimination Algorithm (CEA), which is a supervised technique for learning concepts from data

### Extended Euclidean Algorithm

Filed under Math and Logic

Learn about the extended Euclidean algorithm (EEA).

### Finding the K Smallest Numbers in an Array

Filed under Sorting

In this tutorial, we’ll show several ways to find the $k$ smallest numbers in an array. We’ll also discuss those methods’ complexity and relative performance to one another.