Mergesort

Mergesort Mergesort is an efficient and widely used sorting algorithm. Stable sorting algorithm: preserves the order optimal time complexity: N log N in all cases suboptimal in space usage: usage of an extra array for merging Usage examples: Sorting Linked Lists when space is not a concern. Java default algorithm Read more…

Java Array Exercises

This article contains a series of exercises on java arrays, including resizing array implementation, merging sorted arrays, etc.. Resizing-array implementation A Java ArrayList is a resizable-array implementation of the List interface providing amortized-time for insertion of O(1). Exercise: implement a ResizingArray class providing O(1) amortized-time for insertion. Growing the array Read more…

EMF Modeling and Code Generation

This article shows how to quickly build an EMF model using the Ecore Tools UML editor and generate the Java source code. For this article I am using eclipse eclipse-modeling-tools-2019-06. Modeling Motivations Main motivations for modeling and code generation: separation of application logic w.r.t. implementation: your independent model can be Read more…

Algorithms

Sorting, searching, and binary search Divide-and-conquer Dynamic programming and memorization Greedy algorithms Recursion Graph traversal, BFS and DFS Sorting Main algorithms presented Mergesort: Java sort for Objects Quicksort: Java sort for primitive types Heapsort Mergesort vs Quicksort vs Heapsort All these algorithms have O(N log N) average time complexity, though Read more…

Data Structures

Good knowledge of common data structures is needed in computer science. This article describes common data structures, and present cost and benefits. Lists A List is an abstract data type representing a finite collection of ordered elements. Typically, a List is allocated dynamically depending on the implementation. For example, Array-based Read more…

Maven multi-module in Eclipse

You use maven in Eclipse, and need to work with multi-module (hierarchical) projects? This page shows how to create and work with maven multi-module projects in Eclipse. For this article, I am using eclipse-jee-2019-06, which already supports maven. If you use a different version of eclipse, make sure the m2e Read more…

Maven basic examples in Eclipse

Here are three examples covering maven basics in Eclipse such as: convert a java project to maven nature, create a project with an archetype selection, and refresh/update projects and understand files and structure. For the article, I use eclipse-jee-2019-06, which already provides maven support. If you use a different version Read more…