Can implement circular lists using stack?
No. A stack is a data structure that allows insertion and removal at the top. A circular list allows insertion and removal anywhere in the list. The two types of data structure are too different to be reasonably implementable in terms of each other.
What types of data used in algorithm?
Whatever data you need. If you need the algorithm to operate with many different types of data, and you are programming in C++, you could use generic programming practices and use templates.
How do you stop writing a file in c by using ctrl z in cpp?
Ctrl+Z mean EOF in WinDos, no matter what programming language you are using.
How do you use set and get in object-oriented programming?
A set function (or setter) is an object mutator. You use it to modify a property of an object such that the object's invariant is maintained. If the object has no invariant, a setter is not required.
A get function (or getter) is an object accessor. You use it to obtain a property from an object such that the object's invariant is maintained. If the object has no invariant, you do not need a getter.
How compiler differ form interpreter?
because the compiler convert whole of the sentence once into the machine langauge but the interpreter convert one by one
Where would you use union in C language?
Subudhi Pamisetty
With a union, you're only supposed to use one of the elements, because they're all stored at the same spot. This makes it useful when you want to store something that could be one of several types. A struct, on the other hand, has a separate memory location for each of its elements and they all can be used at once.
union foo {
int a; // can't use both a and b at once
char b;
} foo;
struct bar {
int a; // can use both a and b simultaneously
char b;
} bar;
union foo x;
x.a = 3; // OK
x.b = 'c'; // NO! this affects the value of x.a!
struct bar y;
y.a = 3; // OK
y.b = 'c'; // OK
edit: If you're wondering what setting x.b to 'c' changes the value of x.a to, technically speaking it's undefined. On most modern machines a char is 1 byte and an int is 4 bytes, so giving x.b the value 'c' also gives the first byte of x.a that same value: union foo x;
x.a = 3;
x.b = 'c';
printf("%i, %i\n", x.a, x.b);
prints 99, 99
Why are the two values the same? Because the last 3 bytes of the int 3 are all zero, so it's also read as 99. If we put in a larger number for x.a, you'll see that this is not always the case: union foo x;
x.a = 387439;
x.b = 'c';
printf("%i, %i\n", x.a, x.b);
prints 387427, 99
To get a closer look at the actual memory values, let's set and print out the values in hex: union foo x;
x.a = 0xDEADBEEF;
x.b = 0x22;
printf("%x, %x\n", x.a, x.b);
prints deadbe22, 22
You can clearly see where the 0x22 overwrote the 0xEF.
BUT
In C, the order of bytes in an int are not defined. This program overwrote the 0xEF with 0x22 on my Mac, but there are other platforms where it would overwrite the 0xDE instead because the order of the bytes that make up the int were reversed. Therefore, when writing a program, you should never rely on the behavior of overwriting specific data in a union because it's not portable.
Which data structure has the fastest insertion procedure?
You are confusing data structures with data containers. Data containers include arrays, vectors, lists, and binary trees, to name but a few. The one thing they have in common is that they are all aggregates of homogeneous types. By contrast, a data structure is an aggregate of heterogeneous types.
As to which data container offers the fastest insertion, the reason we have so many container types in the first place is simply because there is no one container that gives optimal performance in all cases. If we need to insert at the back of a container, we will typically use a vector (a variable-length array). If we need to insert at both the back and the front of a container, we will typically use a list. If we need to maintain sorted order, we will typically use a binary tree.
However, these are merely guidelines. The only way to determine which container gives the best performance in any given application is to conduct your own performance tests. Remember also that containers are used for more than just insertion, so choosing a container based solely upon its insertion performance may not be the best option overall.
What is a high speed data searching and sorting in data structure algorithm?
Binary Search is the high speed data searching.Here in each recursion the is divided in two equal halves so that execution becomes easier.
What advantage does Java's break statement have over C's break statement?
They do the same thing, but only the former can be used in a Java program.
Are the expressions ARR and and ARR same for char20?
Yes, 'ARR' and 'ARR' are the same for char20. Whatever it means.
What is data and what are the different types of data available in the market?
Data is, basically, information. Armed with that knowledge, you can probably either answer your own second question or see how silly it is.
| --- add (enqueue) ---> ... | --- remove (dequeue) ---> |
By definition, First-in-First-out is the primary characteristic of being a queue. For any given time, the position of adding an item, or enqueue, is always from the left (directions shown as above, but they are just abstraction), and deleting one, or dequeue, is always from the right. The derived property or attribute of a queue is the adding position is always >= deleting position
When the positions of these 2 fundamental operations are at the same position, the queue is EMPTY. And we know there is no way to be less than EMPTY of a queue, right?! Thus, insertion and deletion positions of the queue are NEVER interchanged.
If they could be interchanged, then the thing you have is just a container, not a specialized container to fulfill First-IN-First-OUT (QUEUE). (the ones in the container are not served as the order they came in)
How do you read the number of capital letters in a input file using c language?
#include <stdio.h>
#include <ctype.h>
...
int caps = 0;
int c;
file = fopen ("InputFile", "r");
while ((c = fgetc (file)) != EOF) {
if (isupper (c)) ++caps;
}
fclose(file);
...
What is the command to find the maximum and minimum of 10 numbers in flow charts?
There are no commands in flowcharts...
How do you open inc. file extensions?
INC file extensions usually indicate that they are "include" files (i.e. they are written with the intent to being called from another source code file). These files are opened using any normal text editor, such as Notepad, Vi, or Edit. Special editors also exist for the language that the source code within is written in, and typically includes auto-completion, syntax highlighting, and error checking.
varchar
What is null printer in c plus plus?
There is no such thing as a null printer in C++. You are perhaps thinking of the null device to which output can be redirected from the command line (effectively hiding the output of a program). However this has nothing whatsoever to do with C++, it is entirely dependant upon the operating system.
It depends on the compiler installed and on the operating system. In unix, you would generally say...
cc -o program program.c
or
make program
What is the purpose of the keyword void in a function declaration?
when we declare any function with void,it doesnt return any value
Example:
for (i=0; i<argc; ++i) {
print ("%2d. '%s'\n', i, argv[i]);
}
Which is the keyword used to limit the scope of a function to the file in which it resides?
Declare the function static.
A serial number is a unique, identifying number or group of numbers and letters assigned to an individual piece of hardware or software. A serial number for a piece of software is not usually the same as a product key but they are sometimes used interchangeably.