Category: Java

A Star (A*) Algorithm with Caching – Java Implementation

Route calculation is computationally an expensive operation. There are several ways how to reduce computational load on the backend. I’ll show you how I optimized my computational resources. There are times where a bunch of people is heading to the same event using the same or at least similar paths. Following this logic, it is ...

A Star (A*) Algorithm Implementation in Java

A* algorithm can be seen as an heuristic extension of Dijkstra’s. Whereas in the Dijkstra’s priority-queue ordering is based only on the distance from the start node to the current, A* algorithm additionally calculates the distance from the current node to the goal-node. Thus the ordering in the priority queue is different and the algorithm ...

Dijkstra’s Algorithm implementation in Java

The Breadth First Search (BFS) algorithm basically checks only if there is a path from node A to node B. It’ doesn’t necessarily find the shortest path between two graph nodes. Here comes Dijkstra into the game. Dijkstra’s algorithm finds the shortest possible route between two graph nodes. The main difference between Dijkstra and BFS ...

Java MapReduce for top N Twitter Hashtags

Back in 2015 i had to implement MapReduce job to extract top 15 hashtags from  twitter’s raw data in Hadoop. This was a part of Business Intelligence lecture exercise at Vienna University of Technology. Regex used (not the best one by my opinion), for hashtag extraction, has following format: String regex = “text\”:\\\”(.*)\\\”,\”source”; The ‘source’ field comes ...

Black Jack in Java

Back in 2009 at the University we had to implement a game for mobile devices in J2ME. We chose Black Jack and I did the business logic. The logic consists of 3 packages. The bl package implements interfaces from the interfaces package and the executable is in the game package. So here is the code … Package: game ...