Facebook

Computer Science

For Loops

It’s easy and quick to print a name one time or two times. But what if we want to print same name 1000 times? What if we want to print a table of a number? What if we want to print a similar pattern again and again? In order to solve these questions and in… read more »

Strings in Java

String is a non primitive data type in Java. Non primitive refers to an object i.e it refers to a memory location where data is stored and are created by programmers. String is a type of object that can hold text. Syntax to write String String myName = “Hi! Jack.”; String is a class and… read more »

Variables and Data Types in Java

Variable is a kind of box that stores value. This box or space is a part of memory that contains data value. Before declaring and initializing variables let us see some rules to write them. Rules to write Variable names in Java It is always better to choose a  name that describes the purpose of… read more »

How to write Java Program

In order to write Java code, use any of the IDE’s available. Create a project say “sample” and then create a class say “DemoPrint” in IDE. By convention the class names should be nouns with each internal word capitalized. In java, code is written inside a class. Let’s say we want to print a statement… read more »

What is Java and How It Works

Java is one of the very important and commonly used programming languages in the industry. It’s a free, secure and reliable and fast platform. Most of the applications and websites work only if java is installed in the computer. For example : It is used in websites like Google Drive, bank websites, Android apps, trading… read more »

Installation of Java on MAC OS

In order to install Java on MAC OS we need to follow some steps. Here are the things required : Install JRE Install JDK Install IDE Install JRE Download JRE. Go to Google search engine and search for jre 8. See Fig 1.   Click on Java SE Runtime Environment 8 – Downloads – Oracle… read more »

Big O Notation

  It gives rate of growth of step count function(f(n)) in terms of simple function(g(n)) and defines the asymptotic upper bound on function(Fig 1). To simplify the estimation for running time,constants and lower order terms are ignored. The function needs to satisfy following conditions in order to be in Big-O class.Given functions f(n) and g(n),we… read more »

Time and Space Complexity

Before defining the actual term complexity, let us discuss about few real life scenarios. Take an example of railway reservation counter, people go there to book their tickets. The time to book tickets will depend on  how many service windows are available, queue size and time taken by each representative. A person will either go… read more »

Pop operation in Stack

POP Operation In this  operation topmost element is deleted from the stack.Before deleting check if TOP = NULL.If yes,it means that stack is empty and no deletion can be done.If an attempt to delete element is made in this case the UNDERFLOW message will be printed on screen.If no,then element is deleted then value of… read more »

Push operation in Stack

Push Operation In this operation,the element is inserted at the top of stack(Fig 4). In order to insert element we need to check whether TOP = MAX-1. If  yes,then insertion  is not possible. If  element is still  tried for insertion , OVERFLOW message will be printed on screen as the stack do not have extra… read more »

Sidebar