Skip to content
First & last occurrence of item in sorted array and three way quick sorting algorithms 😢
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
README.md

README.md

Find first and last occurence of element within a sorted array in O(logn)

Running

First and foremost, open ExercisesSet1.java and comment/uncomment lines 7/8 depending on what algorithm you want to run. Then do the following.

cd src

javac *.java

java ExercisesSet1

The place will be filled with .class files but eh.

You could use something like this not only for this project but for future ones as well for a cleaner barebones setup.

#!/bin/bash
mkdir -p build;
javac src/*.java;
for i in $( ls src | grep class ); do
  mv "src/$i" build/
done

Three way QuickSort algorithm

Algorithm complexity

Average case Worst case
O(nlogn) O(n^2)
Running

Once again, open ExercisesSet1.java and comment/uncomment lines 7/8 depending on what algorithm you want to run. Then do the following.

cd src

javac *.java

java ExercisesSet1

You can’t perform that action at this time.