Showing posts with label sorting. Show all posts
Showing posts with label sorting. Show all posts

Saturday, 21 October 2017

Concurrent Quick Sort Class in OpenMP

Q: Design a class for concurrent quicksort in C++.

Decided to use OpenMp since Pthread doesn't work well with classes, not without ton's of efforts.

Friday, 20 October 2017

Recursive & Iterative Binary Search in Scala

Scala

My very first program in Scala. And I don't find Scala close to Java. I am quite used to Java and C++ and rather find the two more close as very as programming is concerned.

Scala however is closer to Java since scala code is converted to Java Bytecode and the executed.

Program

I used 2 classes a Binary Search class & a Tester object
. An object is more like a singleton class according to my understanding. 
The BinarySearch class has constructor which accepts a sorted array.
It has 2 functions 
  1. A Recursive Binary Search
  2. An Iterative Binary Search.

Tuesday, 1 November 2016

C++:Printing the kth smallest suffix for a string

Prequisistes

  • Stl vector
  • std::sort() for vector
  • Pointers

Code 

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

Wednesday, 2 December 2015

Sorting in Python


  1. This article covers various sorting techniques using Python Programming and Object Oriented Concepts. 
  2. The sorting techniques have been implemented using functions inside a class.
  3. The following sorting techniques have been covered:-