I believe it's simply a list of objects, with each object pointing to the next object. There is a value which keeps track of the list location (the head). Also the last object points to null.
head ----- data|pointer -----> data|pointer -----> data|pointer -----> data|NULL
This is a very basic form of such a list, and it's pretty inefficient, especially when it comes to adding values to the end of the list. A way to improve that would be to add a 'tail' variable so the last value can be easily found.
C plus plus program to find all even numbers between 100 and 150 using for loop?
#include
int main(){
int i;
for(i=2;i<=100;i=i+2){
printf("%d\n",i);
}
}
What is the effect of shifting an unsigned number in a register two bits to the right?
The number is divided by 4.
A function object is a computer programming construct allowing an object to be invoked or called as if it were an ordinary function, usually with the same syntax ...
What are the functions of POP?
POP is Procedural Oriented Programming, this is an approach in which a problem is solved by breaking it into step by step phases of a full procedure.
C is a Programming Language is based on this approach.
How operating system performs in peripheral management?
Operating systems manage peripherals through a component called device drivers, which act as intermediaries between the hardware and the software applications. They handle communication by translating high-level commands from the OS into device-specific instructions. The OS also employs system calls to facilitate input and output operations, managing data transfer and ensuring that multiple applications can access peripherals without conflict. Additionally, the OS may implement buffering and caching to optimize performance and reduce latency in peripheral interactions.
Is there any pointer called ds cs es ss pointer in C programming?
yes, ds cs es ss are pointers available in c which is used to refer memory segments
-.31 = -31/100
-.31 = -31/100
-.31 = -31/100
-.31 = -31/100
What country is the least technologically advanced?
Zimbabwe has the lowest GDP per capita (per person) and has recently experienced hyper inflation.
/*
Given two trees, return true if they are
structurally identical.
*/
int sameTree(struct node* a, struct node* b) {
// 1. both empty -> true
if (a==NULL && b==NULL) return(true);
// 2. both non-empty -> compare them
else if (a!=NULL && b!=NULL) {
return(sameTree(a->left, b->left) &&
sameTree(a->right, b->right)
);
}
// 3. one empty, one not -> false
else return(false);
}
What are the different methods of storing data in a program?
Program data can be stored in the program's data segment, on the stack or on the heap. Constants, static variables and global variables are always stored in the program's data segment. Local variables are always stored on the stack. Dynamic variables are always stored on the heap.
User data is typically stored in files, but those files could exist literally anywhere, such as a local hard-disk drive, a file-server or "the cloud". However, data must be brought into working memory in order to operate upon it. Small amounts of data can be allocated within the data segment via static variables but generally you will use the heap. If the data is too large to fit into working memory all at once, use one or more temporary files on one or more local hard-disk drives and pull in what you need as and when you need it.
Why does It say failed to load the launcher DLL when you try to play portal 2?
Go to the Library in Steam,
right click Portal 2>Properties>Local Files>Verify Integrity of game cache,
then wait for it to finish and try to launch the game again.
Difference between declaring a variable and definition a variable?
Declaration is a promise: 'I will define (or has defined) this variable/function somewhere else'.
How can you capture a signature electronically?
There are several techniques
If you mean 'electronic signature', this is a different thing - it can refer to a method of electronically verifying that a document ( possibly including a written signature ) has not changed after the "electronic signature" process.
To check for divisibility, use the modulus, or % operator. If the expression results in zero, then the first number is divisible by the second number. For example, 10%5 equals 0 because 10 is divisible by 5. When the expression does not result in 0, the number is not divisible(10%7=3, so 10 is not divisible by 7).
they are like interrupt handlers
when a message arrived, a thread poped and handle it
What is the difference between platform independent and portable in programming?
There is no difference. They mean exactly the same thing. Portable code is independent of the platform while non-portable code is platform-dependant.
How can you use long names at the DOS prompt?
Use quotes to surround the long name. Example: >dir "John Doe"
What do you mean by logical operators?
I think you may mean logic operators, also known as Boolean Algebra. Some of the more common being OR, AND, NAND, NOR, NOT, and XOR. These are used mainly in the Binary numbering system, 1's and 0's. For example in a two input OR, either input being a 1 the output will be 1. In a two input AND both inputs must be a 1 to get an output of 1.
What is pseudo code for LCD of two numbers?
The LCD (least common denominator) is better known more generally as the LCM (least common multiple). The LCM of any two integers, typically denoted LCM (a, b), is the lowest positive integer that is evenly divisible by both integers. That is, LCM (a, b) = c such that c/a = c/b. Division by zero is undefined thus it stands to reason that neither a nor b can be zero. However, many people regard LCM (a, 0) = a to be valid even though it is technically undefined, as is LCM (0, 0). Note that either a or b may be negative but LCM (a, b) must always be positive.
The product of a and b is obviously a common multiple of a and b. However, it is not necessarily the lowest common multiple. For instance, 20 is the product of 2 and 10 and is therefore a common multiple of 2 and 10. However, the lowest common multiple of 2 and 10 is 10 because 10/2 = 5 and 10/10 = 1. From this we can surmise that LCM (a, b) can be no greater than the product of a and b and it cannot be any less than the largest of a and b.
There are several ways to calculate the LCM of two integers, however one of the simplest is by reduction by the greatest common divisor (GCD). That is, GCD (a, b) = c such that a and b are evenly divisible by c. The GCD and LCM are similar types of problem, however the GCD is much easier to calculate and can be implemented efficiently using Euclid's algorithm.
In pseudo-code, we can write the GCD (Euclid) algorithm as follows:
algorithm GCD (a, b) is:
while (a <> b) do
if a > b then a := a - b else b := b - a
end while
return a
From this we can now write the LCM algorithm in terms of the GCD algorithm:
algorithm LCM (a, b) is: return a / GCD (a, b) * b
Note that a * b / GCD (a, b) produces the same result, however it is more efficient to perform the division before the multiplication. This is because a / GCD (a, b) is guaranteed to be an integer that is less than or equal to a and is therefore guaranteed not to overflow. Multiplying that integer by b may still overflow, however the chances of overflow are reduced compared to that of multiplying a and b prior to the division.