
Wednesday, May 4, 2016
what is the Complexity of Bubble Sort?

Complexity of Bubble Sort : The time for a sorting algorithm is measured in terms of the number of comparisons. The number f(n) of comparisons in the bubble sort is easily computed.Specially, there are n - 1 comparisons during the first pass, which places the largest element in the last position; there are n - 2 comparisons in the second step, which places the second largest element in the next-to-last position; and so on. Thus
f(n) = (n-1)...
Saturday, April 30, 2016
/* Another Methods of Traversing in a Linear Array */
#include<stdio.h> /* Header File that are called standard input output*/
#include<conio.h> /* Header File that are called consol input output*/
void main(){ /*start the main function and void that are not return type*/
clrscr(); /* Clear the screen at every time when input new element*/
int...
Traversing in a Linear Array
/* Traversing in a Linear Array */
#include<stdio.h> /* Header File that are called standard input output*/
#include<conio.h> /* Header File that are called consol input output*/
void main(){ /*start the main function and void that are not return type*/
clrscr(); /* Clear the screen at every time when input new element*/
int LA[] = {5,6,7,8,3}; ...
Procedure P2.9A : CROSSOUT(A, N, K)
1. If A[K] = 1, then : Return.
2. Repeat for L = 2K to N by K:
Set A[L] : 1.
[End of loop]
3. Return.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOL...
Complexity;Space-Time Tradeoffs
Briefly describe the notations of (a) the complexity of an algorithm and (b) the space-time tradeoff of algorithms :
(a) The complexity of an algorithm is a function f(n) which measures the time and/or space used by an algorithm in terms of the input size n.
(b) The space-time tradeoff refers to a choice between algorithmic solutions of a data processing problem that allows one to decrease the running time of an algorithmic solution by increasing the space to store the data and vice versa.
If You want to learn about the technology,...
Friday, April 29, 2016
Program to convert an Expression from Infix to Postfix
#include<stdio.h>
#include<stdlib.h>
#define MAXCOLS 80
#define TRUE 1
#define FALSE 0
void postfix(char*, char *);
int isoperand(char);
void popandtest(struct stack*, char*, int*);
int prcd(char, char);
void push(struct stack*, char);
char pop(struct stack*);
void main(){
char infix[MAXCOLS];
char postr[MAXCOLS];
int pos = 0;
while ((infix[pos++] = getchar()) != '\n' );
infix[--pos]='\0';
printf("%s%s", "the original infix expression is", infix);
postfix(infix, postr);
printf("%s\n", postr);
} /* end of main */
If...
Using One-Dimensional Arrays Of C Programming Language
#define NUMELTS 100
void main(){
int num[NUMELTS ]; /* array of numbers */
int i;
int total; ...
Thursday, April 7, 2016
Evaluation of Postfix Expression
Evaluation of Postfix Expression :
Algorithm :
1. Add a right parenthesis ")" at the end of P. [This acts as a sentinel]
2. Scan P from left to right and repeat Steps 3 and 4 for each element of P until the sentinel ")" is encountered.
3. If an operand is encountered, put it on STACK.
4. If an operator is encountered, then :
(a) Remove the two top elements of STACK, where A is the top element and B is the next-to-top element..
(b) Evaluate B A
(c) Place the result of (b) back on STACK.
[End...
Arithmetic Expressions;Polish Notation
Arithmetic Expressions;Polish Notation :
Highest : Exponentiation
Next Highest : Multiplication (*) and Division(/)
Lowest : Addition(+) and Subtruction(-)
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SO...
Tuesday, March 22, 2016
Two-Way Header Lists
Two-Way Header Lists:
The advantages of a two-way list a circular header list may be combined into a two-way circular header list as . The list is circular because the two end nodes point back to the header node.Observe that such a two-way list requires only one list pointer variable START, which points to the header node. This is because the two pointers in the header node point to the two ends of the list.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning...