A template function may be overloaded either by template functions or ordinary functions. In such cases, the overloading resolution is accomplished using following steps: Call an ordinary function that has an exact match. If a match for an ordinary function is not found, call a template function that could be created with an exact match. An error is generated if no match is found. Note that no automatic conversions are applied to arguments on the template functions. The program shows how a template function is overloaded with an explicit function. Read More
JDK (Java Development Kit)
JDK is an abbreviation for Java Development Kit. The JDK product, formerly owned by Sun Microsystems, is now owned and maintained by the Oracle Corporation. JDK is licensed under the GNU General Public License (GPL). That is, JDK is a free to use software package. It is a comprehensive development environment primarily aimed for Java developers. It basically envelops a run-time environment that is stacked on top of a operating system. Other tools needed by a Java progammer to code, compile, debug, and test programs also integrate well with the JDK Read More
Prim Algorithm
Given a connected weighted graph G, it is often desired to create a spanning tree T for G such that the sum of the weights of the tree edges in T is as small as possible. Such a tree is called as minimum spanning tree and represents the most inexpensive way of connecting all the nodes in G. There are a number of techniques for creating a minimum spanning tree for a weighted graph. The first of these, Prim’s algorithm, discovered independently by Prim and Dijkstra, is very much like Read More
How to Enable JavaScript
JavaScript is a programming language and platform that allows users to use a wide range of functions and commands that other platforms do not provide. For example, JavaScript allows websites to run interactive menus, flash-based video games, and high quality interactive videos. However, although JavaScript may be used on a website, the viewer’s browser may not have JavaScript enabled, which may prevent the viewer from seeing and using the components that the website has to offer. Applications As mentioned before, JavaScript can be used to provide websites with additional features Read More
Bucket/Radix Sort
Most people use the bucket sort method when sorting a list of names in alphabetical order. The procedure is: First, the names are grouped according to the first letter, thus the names are arranged in 26 classes, one for each letter of the alphabet. The first class consists of those names that begin with letter A, the second class consists of those names that begin with letter B, and so on. Next, the names are grouped according to the second letter. After this step, the list of names will be Read More
CLASSPATH
CLASSPATH is an environment variable which tells the Java compiler and the JVM where to look for Java class files. In Java 1.2 and later, the CLASSPATH variable is less critical because Java knows how to find the default classes and because Java loads classes from the current directory by default. If you do not want to use an environment variable, you can use the -classpath argument to the Java compiler or the JVM as such: javac -classpath . JavaProg To add a jar file to your CLASSPATH, include the Read More
Function Templates
Like class templates, we can also define function templates that could be used to create a family of functions with different argument types. The general format of a function template is as follows: template <class T> return-type function-name( argument of type T ) { // body of function with Type T } The function template syntax is similar to that of the class template except that we are defining functions instead of classes. We must use the template parameter T as and when necessary in the function body and in Read More
Error Lnk2019
The C++ programming language has become one of the most popular general purpose programming languages taught in schools and used in industry. Its ability to allow programmers to create object oriented programs and tie in to low level constructs, has made it one of the most powerful languages available to developers over the past several decades. An error that can be encountered while building C++ projects is the “Error Lnk2019,” which is displayed when an unresolved external symbol is referenced in a function. In order to resolve the error, a Read More
Deleting an Element from a Linear Linked List
To delete an element from the list, first the pointers are set properly and then the memory occupied by the node to be deleted is deallocated (freed). This tutorial covers the deletion of a node from the following three positions: At the beginning of the list At the end of the list After a given element Deleting from the Beginning of the List An element from the beginning of the list can be deleted by performing the following steps: Assign the value of head (address of the first element of Read More
Insertion in a Linear Linked List
To insert an element in the list, the first task is to create a new node, assign the element to be inserted to the info field of the node, and then place the new node at the appropriate position by adjusting the appropriate pointers. Insertion in the list can take place at the following positions: At the beginning of the list At the end of the list After a given element Insertion at the Beginning of the List First, test whether the linked list is initially empty, if yes, then Read More
Share on: