#include<stdio.h> #include<conio.h> #define max 20 int adj[max][max]; //Adjacency matrix int n; //Denotes number of nodes in the graph void main() {
Information about resetting and configuring Mobile phones (Java, Android, Symbian etc), educational articles especially for programming in C, C++ and Java and more about Computers and operating systems
Showing posts with label data structure. Show all posts
Showing posts with label data structure. Show all posts
C Program To Represent Directed or Undirected Graph Using Adjacency Matrix
C program to represent directed or undirected graph using Adjacency matrix.
Labels:
$ccpp
,
adjacency
,
c program
,
code
,
create
,
data structure
,
directed
,
graph
,
graphs
,
How to
,
matrices
,
matrix
,
programming
,
represent
,
representation
,
undirected
,
using
Binary Tree And Prefix & Postfix Notations Of Arithmetic Expressions
We can construct meaningful derivation trees that enable us to represent arithmetic expressions in infix, prefix and postfix forms. A binary tree is enough to represent all these three notations of arithmetic expressions. Both prefix and postfix notations are unintelligable for humans. But they are of great use in computer science. Compilers often convert infix to prefix notation and then to assembler code. From a derivation tree of an algebraic expression, we can get equivalent prefix and postfix notations. An algebraic expression in terms of operators and operands can be derived by an ambiguous context-free grammar. Prefix notation is the parenthesis-free notational scheme invented by Polish logician Jan Lukasiewicz and is often called polish notation. In prefix notation operators are followed by operands.
For example, in prefix notation A + B is written as +AB. Postfix notation is reverse of prefix notation. AB+ is the equivalent postfix notation of A + B. The infix form is evaluated and the binary tree is created according to the priority of the operators. Let us start from the simplest examples.
For example, in prefix notation A + B is written as +AB. Postfix notation is reverse of prefix notation. AB+ is the equivalent postfix notation of A + B. The infix form is evaluated and the binary tree is created according to the priority of the operators. Let us start from the simplest examples.
Labels:
$studymat
,
arithmetic
,
binary
,
Computer Science
,
conversion
,
data structure
,
expression
,
infix
,
notation
,
Postfix
,
Prefix
,
representation
,
theory
,
tree
Subscribe to:
Posts
(
Atom
)