Advert

Cannot Modify Header Information

Last edited by . Total of no comments in the discussion.

PHP programmers commonly encounter the “Cannot Modify Header Information” error, which is normally displayed when extraneous white space is included in a PHP header file. When a programmer who is new to PHP encounters this error, he/she may become frustrated when trying to determine the problem’s source since the header portion of the programming that he/she has just completed normally generates it. The error can be displayed while working in any PHP-related content management system (CMS) or while writing hand crafted code. What does the Cannot Modify Header Information Error Read More

Share on:

Constructor

Last edited by . Total of no comments in the discussion.

A constructor is a special dedicated method to initialize a new instance of a class. The constructor method for a class will have the same name as the class. A class can contain more than one constructor method, but each having a different set of parameters. They are called overloaded constructor methods. A constructor method is the first method that’s called and executed when a new object is instantiated. It’s primary usage is to assign default values to variables, do basic cleanup or calculation, etc. A constructor method is not Read More

Share on:

Object

Last edited by . Total of no comments in the discussion.

A Java object is basically a set of data, data structures, and methods combined together to form a single entity. An object is an instance of class. Therefore, a class is said to be a blueprint of an object. Every object instantiated from a class will contain its own copy of member variables and member methods (unless they are declared static). Member methods are created to help an object process its member variable and take required actions. Creating Objects The are three major steps involved while creating an object from Read More

Share on:

if Statement

Last edited by . Total of no comments in the discussion.

An if/else statement tests a particular condition, if the condition evaluates to true, a course-of-action is followed i.e. a statement or a set of statements is executed. Otherwise another set of instructions are executed (the else block). Such statements are called program control statements that control the flow of execution in a program. Normally, the statements are executed sequentially as written in the program. This is known as normal flow of control. But sometimes, the flow of control of a program has to be altered depending upon certain conditions. The Read More

Share on:

Arrays

Last edited by . Total of no comments in the discussion.

An array is a collection of C or C++ data elements or objects of the same type. Individual elements of an array are referenced using one or more integer indices. A one-dimensional array is defined with a statement such as double vector[50]. This defines (and allocates space for) 50 variables of type double that are contiguously located in storage. This means that 50 different values can be stored without having to initialize 50 different variables, each one with a different identifier. Instead an array can store 50 different values of Read More

Share on:

this Pointer

Last edited by . Total of no comments in the discussion.

On defining a class, the member functions are created and placed in the memory space only once i.e., only one copy of member functions are maintained, that is shared by all the objects of the class. Memory space for the data members is allocated separately for each object. This has an associated problem. If only one instance of member functions exist, how does the compiler come to know which object's data member is to be manipulated? For example, if member-function3 is capable of changing the value of data-member2 and the Read More

Share on:

Kruskal’s Algorithm

Last edited by . Total of no comments in the discussion.

An algorithm which is used to create a minimum spanning tree is attributed to Kruskal’s algorithm. The nodes of the graph are initially considered as n distinct partial trees with one node each. At each step of the algorithm, two distinct partial trees are connected into a single partial tree by an edge of the graph. When only one partial tree exists (after n-1 such steps), it is a minimum spanning tree. The concern is what connecting arc to use at each step. The answer is to use the arc Read More

Share on:

Insertion Sort

Last edited by . Total of no comments in the discussion.

This algorithm is very popular with bridge players when they sort their cards. In this procedure, we pick up a particular value and then insert it at the appropriate place in the sorted sub list. This algorithm requires n-1 passes. Pass1: a[1] is inserted either before or after a[0] so that a[0] and a[1] are sorted. Pass2: a[2] is inserted either before a[0] or between a[0] and a[1] or after a[1] so that the elements a[0], a[1], a[2] are sorted. Pass3: a[3] is inserted either before a[0] or between a[0] Read More

Share on:

Copy Constructor

Last edited by . Total of no comments in the discussion.

A copy constructor is a class constructor that can be used to initialize one object with the values of another object of the same class during the declaration statement. In simple words, we can say that, if we have an object called myObject1 and we want to create a new object called myObject2, initialized with the contents of myObject1 then the copy constructor should be used. Consider the declaration given below: myClass myObject1; … (1) myClass myObject2(myObject1); … (2) The declaration (1) declares an object myObject1 of class myClass. The Read More

Share on:

Shell Sort

Last edited by . Total of 2 comments in the discussion.

Invented by Donald Shell in 1959, Shell sort is the most efficient of the O(n2) class of sorting algorithms. It is also the most complex of the O(n2) algorithms. This algorithm is similar to bubble sort in the sense that it also moves elements by exchanges. Shell sort begins by comparing elements that are at distance d. With this, the elements that are quite away from their place will move more rapidly than the simple bubble sort. In each pass, the value of d is reduced to half. In each Read More

Share on: