What is the backoff algorithm?
In a single channel contention based medium access control (MAC) protocols, whenever more than one station or node tries to access the medium at the same instant of time, it leads to packet collisions. If the collided stations tries to access the channel again, the packets will collide as the nodes are synchrozied in time. So the nodes need to be displaced in time. To displace them temporally, a backoff algorithm is used (example binary exponential backoff (BEB)). For example, in BEB algorithm, whenever a node's transmission is involved in a collision with another node's transmission, both nodes will choose a random waiting time and wait for this amoiunt of time before attempting again. If they are not successful in this attempt, they double their contention window and choose a randoim waiting time before transmitting again. This process will be repeated for certain number of attempts. If the nodes are not successful in their transmission after this limit, the packets will be dropped from their queue. Answered by C. Rama Krishna, NITTTR, Chandigarh, India on 03.12.2008 at 11.40 AM (IST)
What are the advantages and disadvantages of dijkstra-scholten algorithm versus Huangs algorithm?
Main disadvantages:
The major disadvantage of the algorithm is the fact that it does a blind search
there by consuming a lot of time waste of necessary resources.
Another disadvantage is that it cannot handle negative edges. This leads to
acyclic graphs and most often cannot obtain the right shortest path.
Can microwave transmission use terrestrial systems?
it is the transmission of microwaves. One person throws a microwave to another person and so on.
Write a program to find gcd using recursive method in java?
for two positive integers:
public static int gcd(int i1, int i2) {
// using Euclid's algorithm
int a=i1, b=i2, temp;
while (b!=0) {
temp=b;
b=a%temp;
a=temp;
}
return a;
}
What are the different tree methodologies in data structure?
The question itself is a bit vague since it doesn't suggest whether you're asking about the types of trees or the operations which can be performed on trees.
A tree is a data structure which stores information in a logical way that typically is ideally suited for searching quickly, often by ordering the nodes or items of the tree, also ideally, nodes should be able to be added to or removed from a tree quickly and efficiently. Often, trees are chosen as a means of simply structuring data in a meaningful way with no concerns as to their performance.
When trees are chosen as an alternative to a list, the reason for this is to gain the benefits of rapid insertion, searching and deletion of nodes. Common tree structures for this purpose are the binary tree and the black and red tree. A binary tree has an extremely simple and extremely fast method of searching for data, but it is highly dependent on nodes being added in an order which is somewhat random. If ordered data is added to a tree, the depth of the tree will be linear, thereby providing no benefits over a linked list in addition, removal of nodes can cause a binary tree to have to be rebuilt as all the nodes beneath the deleted node will have to be re-added to the tree, typically under different nodes, commonly causing linear branches of the tree and slowing down application performance.
R&B trees were designed to address many of the issues of a binary tree. By developing a data structure which intentionally keeps the depth of the tree shallow, high speed searching and node removal can be achieved, but at a cost to the insertion algorithm which is designed to "shake things up" a little. R&B trees are far beyond the scope of this answer.
General trees are used less as a means of providing ideal performance but instead are intended as a means of providing structure for data. General trees store information in a way which reflects the data format itself. An example of a general tree is the file system of a disk drive. The root directory contains zero or more children which each contain zero or more children which each contain zero or
more... you get the point. This structure is also used for things like the abstract syntax tree of a compiler. Source code is parsed into "tokens" which are the structured as nodes of a tree which are then "walked" when optimizing and producing binary code.
There are many more types of trees. Many of which ate covered by Donald Knuth in extensive, if not insane detail in "The Art of Computer Programming".
Among the operations you'd perform on the tree are insertion, deletion, searching, walking, reduction, simplification and more.
How can you declare global an local variables in flowcharts?
The simple answer is you don't. The primary purpose of a flowchart is to show the flow of execution through an algorithm, with all primary functions and decisions described in broad, abstract terms.
There is no need to distinguish between local and global variables because that is an implementation detail -- it's far too low-level a concept for algorithm design.
All variables utilised by an algorithm should essentially be declared up front at the start of the flowchart and should therefore be treated as being local to that particular flowchart. It doesn't matter where those variables came from, only that they be initialised accordingly. The decision to make a variable global comes much later, once the interactions between different flowcharts have been established. Even so, a global variable should only ever be considered when the variable represents a truly global concept. In the vast majority of cases, passing arguments into functions is often the better option. Especially when separate algorithms are intended to run concurrently because making a global variable thread-safe can seriously impact performance. But this is not a concern in algorithm design, they are only of importance to the implementers; the class designers.
How do you write a program that gives the GCD of three given numbers in C plus plus?
To find the GCD of three numbers, a, b and c, you need to find the GCD of a and b first, such that d = GCD(a, b). Then call GCD(d, c). Although you could simply call GCD(GCD(a, b), c), a more useful method is to use an array and iteratively call the GCD(a, b) function, such that a and b are the first two numbers in the first iteration, which becomes a in the next iteration, while b is the next number. The following program demonstarates this method.
Note that the GCD of two numbers can either be calculated recursively or iteratively. This program includes both options, depending on whether RECURSIVE is defined or not. In a working program you'd use one or the other, but the iterative approach is usually faster because it requires just one function call and no additional stack space.
The program will create 10 random arrays of integers of length 3 to 5 and process each in turn. Note that the more numbers in the array, the more likely the GCD will be 1.
#include<iostream>
#include<time.h>
#define RECURSIVE // comment out to use iterative method
#define ARRAY // comment out to use non-arrays
#ifdef RECURSIVE
// Returns the GCD of the two given integers (recursive method)
unsigned int gcd(unsigned int a, unsigned int b)
{
if(!a)
return(b);
if(!b)
return(a);
if(a==b)
return(a);
if(~a&1)
{
if(b&1)
return(gcd(a>>1,b));
else
return(gcd(a>>1,b>>1)<<1);
}
if(~b&1)
return(gcd(a,b>>1));
if(a>b)
return(gcd((a-b)>>1,b));
return(gcd((b-a)>>1,a));
}
#else
// Returns the GCD of the two given integers (iterative method)
unsigned int gcd(unsigned int a, unsigned int b)
{
if(!a)
return(b);
if(!b)
return(a);
int c;
for(c=0; ((a|b)&1)==0; ++c)
{
a>>=1;
b>>=1;
}
while((a&1)==0)
a>>=1;
do{
while((b&1)==0)
b>>=1;
if(a>b)
{
unsigned int t=a;
a=b;
b=t;
}
b-=a;
}while(b);
return(a<<c);
}
#endif RECURSIVE
// Returns the greatest common divisor in the given array
unsigned int gcd(const unsigned int n[], const unsigned int size)
{
if( size==0 )
return( 0 );
if( size==1 )
return( n[0] );
unsigned int hcf=gcd(n[0],n[1]);
for( unsigned int index=2; index<size; ++index )
hcf=gcd(hcf,n[index]);
return(hcf);
}
int main()
{
using std::cout;
using std::endl;
srand((unsigned) time(NULL));
for(unsigned int attempt=0; attempt<10; ++attempt)
{
unsigned int size=rand()%3+3;
unsigned int* num = new unsigned int[size];
unsigned int index=0;
while(index<size)
num[index++]=rand()%100;
unsigned int hcf=gcd(num,size);
cout<<"GCD(";
index=0;
cout<<num[index];
while(++index<size)
cout<<','<<num[index];
cout<<") = "<<hcf<<endl;
delete[]num;
}
cout<<endl;
}
List four functions of registers in assembly language?
Because registers are where all the actual work is done by the CPU. Think of registers as being a bank of switches which can be configured so the CPU can perform a specific operation upon a specific set of operands, be they values or memory addresses where values can be found. Some operations have no operands while others have one or two, but in order for the CPU to know which operation and which operands it should operate upon the registers must be set accordingly. The CPU achieves this through a repeating fetch-decode-execute cycle, fetching the next instruction, decoding its operands and then executing the instruction. In a multi-threaded environment, the CPU must also save the state of the registers to allow another thread to restore those registers for itself. In this way, a single CPU can switch from one thread to another and pick up from exactly where it left off.
Which the best programming language between java and visual basic?
Java.
While Visual Basic is certainly useful for writing Windows applications, that's all it can do. If you want the same program to run on other platforms (such as Linux), the entire program must be re-written from scratch.
With Java, there is no need to convert. Once compiled, Java programs can be executed upon any platform that has a suitable Java virtual machine implementation, which is pretty much everything today.
Three address code in compiler design?
prod=0;
i=1;
do
{
prod = prod +a[i] * b[i];
i=i+1;
} while(i<=20);
What are the kinds of toolbar?
There are three types of toolbar as written bellow : 1. Menu Bar
2. Docked Toolbar
3. Built-in Toolbar.
String reverse program with single string and without using library functions in java?
You can create a separate string initially empty. Then using a loop, start at the end of the string and add it to the end of the other string. At the end of the loop, the other string would contain the reverse.
String concaination program using pointers in C?
#include<stdio.h>
#include<conio.h>
void main()
{
char a[5][10];
int i;
clrscr();
for(i=0;i<5;i++)
{
printf("enter %d string",i+1);
scanf("%s",&a[i]);
}
for(i=0;i<5;i++)
{
printf("\n%s",a[i]);
}
getch();
}
Difference between register and memory?
Registers are storage locations internal the the processor. CPU instructions operate on these values directly. On RISC processors, all data must be moved into a register before it can be operated. On CISC (Intel) chips, there are a few operations that can load data from RAM, process it, and save the result back out, but the fastest operations work directly with registers.
Also, there are registers that are set aside for certain tasks, these generally include a program counter, stack, and flags.
Each register also has a size that determines the maximum amount of data that can be processed at a time. The registers on Pentium chips, for example, are 32 bits.
Finally, there are generally only a few registers available on a processer. Intel chips, for example, have 6 general purpose registers, and several specialized registers including a base register, stack register, flags register, program counter, and some addressing registers.
Memory, or RAM, is located external to the CPU. Generally speaking, data has to be loaded into a CPU register from memory before the CPU can process it, RAM is much slower than registers, there is a lot more RAM than registers, and generally memory can be addressed on a byte boundaries, where registers may not be able to access all the bytes in a register.
To summarize: in general, registers are temporary storage in the CPU that holds the data the processor is currently working on, while RAM holds the program instructions and the data the program requires.
Hopefuly this helps,
--Eric Tolman
Write an algorithm to find the numbers divisible by 3 but not by 6 and then draw the flowchart?
Start
Input a
if a%3 = 0 then
Print a
else
print" enter another number"
end
1. start
2. Input N
3. if N<3, go to step 6
4. if N%3 && N%6!=0 then
print N
5. N=N-3 go to step 3
6. end
What is the minimum wage of UK?
This question is not very specific, I would say that the lowestofficial salary in the UK are people who are on the minimum wage generally around £12,000 a year, the minimum wage can be different for how old you are, if you are in education, or if you claim any kind of benefits.
But unofficially, there are people working for far less than that and you cannot determine there salary.
How did Bill Gates become a billionare?
he made an acount were he documented his money and then he gained intrest then 500 years later he had billions and made Microsoft
Disadvantages of using ICT in education?
Chat Online
User use chat application for their own interest.
Print Personal Stuffs
Staff will use company resources such as printer to print their personal stuff document.
Online Movie/ Radio/ Download Music
Cannot Troubleshoot Remote Computer
Cannot Track Computer Assets Changes
Administrator Faces Heavy Workload
Yes, a computer can count. You could get a computer to count forever, if you wanted to. All a computer does is compute information. So yes, you could get a computer to count. But, wouldn't your fingers suffice?
Application of object-oriented programming?
A virtual function must be declared as a non-static member method of a class that you expect to act as a base class. Declaring a virtual function adds some overhead as a result of creating the v-table (virtual method table), but most of that overhead is paid with the first virtual function (subsequent virtual functions just add a new entry to the already-existing v-table). However, do not declare a virtual function unless you expect that function to be overridden. Bear in mind that overriding an overloaded, non-virtual function "hides" all the overloads in the base class.
If a virtual function must be overridden, declare it as pure-virtual instead. You do not need to implement the method in the base class, but you will be reminded to provide an implementation in the derived class at compile time if one does not exist, even if you provide a default implementation in the base class. Bear in mind that base classes with one or more pure-virtual methods become abstract -- they cannot be instantiated.
If there is any virtual function or pure-virtual function, there must also be a virtual destructor, as well as a public or protected default constructor (a constructor with no arguments). When a derived class is constructed, it calls the base class constructor, which calls its base class constructor. Derived classes are constructed in sequence, beginning with the least-derived class. Destruction is the reverse -- the most-derived class is destroyed before the base classes are destroyed.
Virtual functions can be invoked just like any other class member method, both via an object reference's member operator (.), and the indirection operator (-->) for pointers to objects. It does not matter whether the reference or pointer refers to a base class or a derived class; the v-table decides which override (where one is provided) will actually execute, starting from the most-derived override and working back towards the base class, the least-derived. With appropriate use of virtual functions, dynamic casting can be avoided completely (dynamic casting should never be employed as it completely defeats the point of having a v-table in the first place).
How do you find volume of a triangle?
Multiply the area of the base by the height of the object. The area of the base can be found by multiplying the length times the width of one of the faces.
What are the limitations of the C programming language?
An algorithm simply describes the finite, procedural steps required to solve a problem. Algorithms are not specific to any one programming language, but without algorithms there would be no computer programs let alone programming languages. That is, you cannot program a computer to solve a problem unless you know how to solve the problem yourself and for that you need to know the algorithm. Once you have the algorithm, you can program the computer to implement it.
What do you understand by static memory allocation and dynamic memory allocation?
MEMORY ALLOCATION MODELS……
STATIC MEMORY ALLOCATION DYNAMIC MEMORY ALLOCATION
Memory is allocated before the execution of the program begins.
(During Compilation)
Memory is allocated during the execution of the program.
No memory allocation or deallocation actions are performed during Execution.
Memory Bindings are established and destroyed during the Execution.
Variables remain permanently allocated.
Allocated only when program unit is active.
Implemented using stacks and heaps.
Implemented using data segments.
Pointer is needed to accessing variables.
No need of Dynamically allocated pointers.
Faster execution than Dynamic.
Slower execution than static.
More memory Space required.
Less Memory space required.
You cannot compute the sum, difference, product or quotient of a single number. All these operations are binary operations which means they require two operands, which we'll call aand b.
In pseudocode, our program will be something like the following:
input a
input b
print "sum = "
print a + b
print "difference = "
print a - b
print "product = "
print a * b
print "quotient = "
print a / b
This could be implemented in C++ as follows:
#include
int main (void) {
using namespace std;
double a, b;
cin >> a >> b;
cout << "Sum = " << a + b << endl;
cout << "Difference = " << a - b << endl;
cout << "Product = " << a * b << endl;
cout << "Quotient = " << a / b << endl;
}
This is as simple as it gets. A more robust program will take the input as a string and parse it accordingly, thus handling any input error more gracefully.