Hello World Program in Java

Hello World program in java is the basic example. Simplest java program to print “Hello World”. This is the first program for any programmer in any language. The basic steps of java programming include the following 3 steps: Create the program by typing it into a text editor and saving it to a file named, say, Test.java Compile it by…

Program to implement Heap C++

Here is the source code of the program to implement heap C++ programming language. #include <iostream> #include <cstdlib> #include <vector> #include <iterator> using namespace std; // Class Declaration class Heap { private: vector <int> heap; int left(int parent); int right(int parent); int parent(int child); void heapifyup(int index); void heapifydown(int index); public: Heap() {} void Insert(int element); void DeleteMin(); int ExtractMin();…

Program to implement Hash Tables C++

What is Hash Table Program to implement Hash Tables C++ #include<iostream> #include<cstdlib> #include<string> #include<cstdio> using namespace std; const int TABLE_SIZE = 128; /* * HashEntry Class Declaration */ class HashEntry { public: int key; int value; HashEntry(int key, int value) { this->key = key; this->value = value; } }; /* * HashMap Class Declaration */ class HashMap { private: HashEntry…

Program for Sorting Containers Implementation in Stl

Sorting Containers (1) void sort(); (2) template <class Compare> void sort (Compare comp); Sort elements in container: Sorts the elements in the list, altering their position within the container. The sorting is performed by applying an algorithm that uses either operator< (in version (1)) or comp (in version (2)) to compare elements. This comparison shall produce a strict weak ordering…