My Blog
Articles related to programming, computer science, technology and research.

Java program to print unique words in a given line of text

14/05/2018 Categories: Strings. 1 Comment on Java program to print unique words in a given line of text

This java program reads a line of text from the user and prints out the unique words in ascending order.   We use TreeMap class from collections framework to store the frequency of each word in the given line of text and print out only the words with frequency 1, which will give us the […]

Read the rest of this entry »

Java program to print only unique characters in a string

14/05/2018 Categories: Strings. No Comments on Java program to print only unique characters in a string

This java program reads a string from the user, and prints out only the unique characters in the string in insertion order.   First we find out the frequency of each character in the string and then print out only the characters that have frequency as 1. To maintain the insertion order, we use LinkedHashMap […]

Read the rest of this entry »

Java program to print the frequency of characters in a string

14/05/2018 Categories: Strings. No Comments on Java program to print the frequency of characters in a string

This java program reads a string from the user, calculates frequency of each character in the strings and displays the character followed by its frequency in ascending order.   We can maintain the count of each character by using the Map interface from collections framework. To maintain the ascending order, we can use TreeMap class. […]

Read the rest of this entry »

Java program to ignore duplicates in a string and print each character only once in ascending order

14/05/2018 Categories: Strings. 1 Comment on Java program to ignore duplicates in a string and print each character only once in ascending order

This is a Java program that accepts a string from the user, ignores any duplicate characters and prints each character only once in ascending order.   We use TreeSet class from collections framework for printing the characters in ascending order.   The program is as follows:  

  If you want to display in […]

Read the rest of this entry »

Python Programming Tutorial

19/04/2018 Categories: Python Programming. 1 Comment on Python Programming Tutorial

Python is a multi-paradigm language gaining widespread popularity now-a-days due to its simplicity and expressiveness. At the time of writing this tutorial (April 2018), Python is the 5th most popular language according to TIOBEs Index. Python was developed by Guido van Rossum.   This Python Programming tutorial is intended for beginners who have no idea […]

Read the rest of this entry »

Exception Handling in Python

19/04/2018 Categories: Python Programming. No Comments on Exception Handling in Python

Introduction   An error is an abnormal condition that results in unexpected behavior of a program. Common kinds of errors are syntax errors and logical errors. Syntax errors arise due to poor understanding of the language. Logical errors arise due to poor understanding of the problem and its solution.   Anomalies that occur at runtime […]

Read the rest of this entry »

Inheritance and Polymorphism in Python

19/04/2018 Categories: Python Programming. No Comments on Inheritance and Polymorphism in Python

Inheritance   Creating a new class from existing class is known as inheritance. The class from which features are inherited is known as base class and the class into which features are derived into is called derived class.   Inheritance promotes reusability of code by reusing already existing classes. Inheritance is used to implement is-a […]

Read the rest of this entry »

Object Oriented Programming in Python

19/04/2018 Categories: Python Programming. No Comments on Object Oriented Programming in Python

Introduction to Classes and Objects   Classes and objects are the two basic concepts in object oriented programming. An object is an instance of a class. A class creates a new type and provides a blueprint or a template using for creating objects. In Python we already know that everything is an object of some […]

Read the rest of this entry »
Scroll Up