Html/Javascript widget

Sunday, 4 June 2017

A Short Definition for weighted graph

A weighted graph is a graph that ssigns a numerical weight to each branch. As each branch is made up of vertices (or nodes) and edges, they are assigned weigts if they have labelled values: a vertex-weighted graph has weights on its vertices and an edge-weighted graph has weights on its edges.

obs.: Weight is just a numerical value assigned as a label to a vertex or edge of a graph. The weight of a subgraph is the sum of the weights of the vertices or edges within that subgraph.

Quick Introduction to Pointers

A pointer is a variable containing the address of another variable.

Take for instance the declared variable variable1 in C:

int Variable1;
, store the number ‘96’ in it with

and print it out with


Instead of referring to this data store by name (in this instance, variable1), it can be done so by its computer memory address, which can be in a pointer, which is another variable in C. Using the operator '&' means "to take the adress of" while the operator * means to give the pointer whatever is in said address. A pointer to the code above could look like this:


This stores the address of variable1 in the variable Pointer1.

To take the value, we would use *:


which would have the same effect as


or print it out with


So far it should be clear that for pointers we need to use & to take the memory address of a variable while * takes hold of its value.

A pointer is created as below:

int *Pointer1;

The reason that the symbol * comes after the type when delcaring pointers is because it's necessary to specify the type that the pointer has to point to. An int *pointer points only to integer. A char *var points only to chars and so on.

Pointers are necessary for dynamic memory location, data structures and efficient handling of large amounts of data. Without pointers, you'd have to allocate all the program data globally or in functions or the equivalent, resulting in a lot of waste for variables that are not being used but are still taking up memory space.

Interpreter and Compiler

A compiler is a computer program responsible for translating a source code into a language form that can be directly run by the computer. There's though a minor difference between translator and compiler: a translator converts a program from its formal source code to a specific target language. Compilers are a special sort of translators which take program code often written in a high level language to run as machine code or intermediate code (e.g.: Bytecode, .NET-Code etc). This difference between translator and compiler isn't always pronounced in all cases. Programming languages such as C and C++ are compiler-based as they generate an exe file (if you're using windows) after being successfully compiled. An interpreter, on the other hand, doesn't convert source code into a portable format that can be run in a specific platform or system. Rather, an interpreter reads a code line by line and produces an output on a client or server platform. Interpreters need a specific environment setup in order to work properly. Examples of interpreted languages include Javascript and PHP.

Translates code line by line.Runs through whole program to generate an .exe file.
Reads faster but executes slower.It takes more time to scan code but afterwards execution is faster than with an interpreter. 
No intermediate code generated.Intermediate object code that calls for linking, which in turn uses up more memory.
Translation stops at first error.It throws an error message after scanning the entire code.
Input in the form of Single statements The whole program is the input in compiled languages.