answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

WHAT IS THE DIFFERENT algorithm of advantage and amp disadvantage?

Different algorithms do different things, so it makes no sense to compare them. For example, the accumulate algorithm is an algorithm which performs the same operation upon every element of a container, whereas a sorting algorithm sorts the elements of a container. Each specific algorithm requires a different set of concepts. An accumulate algorithm requires a data sequence with at least forward iteration and elements which support the operation to be performed, whereas a sorting algorithm generally requires random access iterators and elements that support a given comparison operation (such as the less-than operator).

Even if two algorithms have the exact same time and space complexities, it does not follow that both will complete the task in the same time. For instance, the accumulate algorithm is a linear algorithm with a time-complexity of O(n) regardless of which operation is being performed. However, the complexity of the operation itself can greatly affect the actual time taken, even when the operations have exactly the same time-complexity. For instance, if we use the accumulate algorithm in its default form (to sum all the elements in a data sequence), the operation itself has a constant-time complexity of O(1). If we choose another operation, such as scaling each element and summing their products, it will take much longer to complete the algorithm (possibly twice as long) even though the operation itself has the exact same time-complexity, O(1).

Consider the time-complexity of adding one value to another:

a += b

This has to be a constant-time operation because the actual values of a and b have no effect upon the time taken to produce a result in a. 0 += 0 takes exactly the same number of CPU cycles as 42 += 1000000.

Now consider the operation to scale and sum:

a += b * 42

Here, 42 is the scalar. This also has to be a constant-time operation, but it will take longer to physically perform this operation compared to the previous one because there are more individual operations being performed (roughly twice as many).

The only way to compare algorithms is to compare those that achieve exactly the same goal but do so in different ways. Only then does comparing their respective time-complexity make any sense. Even so, time-complexity is merely an indication of performance so two sorting algorithms with the exact same time-complexity could have very different runtime performance (it depends on the number and type of operations being performed upon each iteration of the algorithm). Only real-world performance testing can actually determine which algorithm gives the best performance on average.

With sorting algorithms, we often find one algorithm ideally suited to sorting small sequences (such as heap sort) and others ideally suited to larger sets (such as merge sort). Combining the two to create a hybrid algorithm would give us the best of both worlds.

What is modular programing mention any 2 charecteristic?

Modular programming is a design technique which separates a program into small, self-contained units or modules, each focusing upon a particular aspect of the program. Modular programming typically combines structured programming, object oriented programming and generic programming techniques.

What is a variable that has been declared and automatically initialized to zero.?

It really depends on the programming language. In C and C++, all built-in types are initialised to zero when declared static, otherwise they are uninitialised. In Java, however, all data types are implemented as objects and are therefore initialised at the point of instantiation according to whichever constructor is invoked.

Is copy and paste same as drag and drop?

No. Drag and drop is when you drag a file then drop it into the destination folder. You have moved a file from one place to another.

Copy and paste is when you copy a file then paste it into a different location. The original file still remains where it was, but there is how a copy of it elsewhere as well.

How do you shuffle an array in c programming?

Values are the only factor that can be shuffled in C programming. You cannot shuffle the array itself, but the values of them can be shuffled and assigned to new element of array. To shuffle the values of an array, the array that will be shuffled must first be initialized or assigned to any values. Also, you must declare one (1) variable that will temporarily store numbers to be shuffled.
Example:
int arrNum [5];
int intTemp;
arrNum [0] = 3;
arrNum [1] = 8;
arrNum [2] = 4;
arrNum [3] = 7;
arrNum [4] = 1;

Using a for loop, assign the first value of the array to any elements to the array. switch these values to shuffle them. To randomize the shuffle, use . Also, try to seed random numbers to randomize each time you run the program.

#include
#include

int main(void) {

int arrNum [5];

int intTemp;

int randArr;

int ctr;

srand(time(NULL)); //seed and randomize number based on time

arrNum [0] = 3;

arrNum [1] = 8;

arrNum [2] = 4;

arrNum [3] = 7;

arrNum [4] = 1;

for (ctr = 0; ctr < 5; ctr++) {

randArr = 0 + rand() % 4; // Assign a random number to randArr from 0 to 4

intTemp = arrNum[randArr];

arrNum[randArr] = arrNum[ctr];

arrNum [ctr] = intTemp;

}


return 0;
}

What is the source code for a method called max?

That depends on the programming language and the exact implementation of max. Normally, a max function returns the largest of two variables of the same type but can also be applied to a sequence container with 2 or more elements. Both versions may also include a user-defined predicate to perform the comparison(s).

In the C++ standard library, it is implemented as a generic algorithm (a function template) with 4 overloads. These functions become accessible when you include the <algorithm> header from the standard library. They each have the following definitions:

// TEMPLATE FUNCTION max

template<class _Ty> inline

_Post_equal_to_(_Left < _Right ? _Right : _Left)

const _Ty& (max)(const _Ty& _Left, const _Ty& _Right)

{ // return larger of _Left and _Right

return (_DEBUG_LT(_Left, _Right) ? _Right : _Left);

}

template<class _Ty> inline

_Ty (max)(_XSTD initializer_list<_Ty> _Ilist)

{ // return leftmost/largest

const _Ty *_Res = _STD max_element(_Ilist.begin(), _Ilist.end());

return (*_Res);

}

// TEMPLATE FUNCTION max WITH PRED

template<class _Ty,

class _Pr> inline

const _Ty& (max)(const _Ty& _Left, const _Ty& _Right, _Pr _Pred)

{ // return larger of _Left and _Right using _Pred

return (_DEBUG_LT_PRED(_Pred, _Left, _Right) ? _Right : _Left);

}

template<class _Ty,

class _Pr> inline

_Ty (max)(_XSTD initializer_list<_Ty> _Ilist, _Pr _Pred)

{ // return leftmost/largest

const _Ty *_Res = _STD max_element(_Ilist.begin(), _Ilist.end(), _Pred);

return (*_Res);

}

What is the best programming language to learn while job hunting - consider you already know C and Java you only have time to learn ONE which ONE would you learn?

C, Java are usually great. But you should also have a grasp of web designing. It includes HTML, CSS, Javascript, PHP, ASP.NET, SQL, JQUERY and Ruby. You could also learn Java as the applets produced are great for websites.

What are receiving devices in computer?

As the name suggest, a receiving device receives data that is transmitted by a sending device. Your wireless router and network access points are both senders and receivers. A receive-only device is one that receives but does not transmit. An RF receiver is an example of a receive-only device. E.g., a Freeview receiver can receive digital television transmissions but it does not transmit. A receiver is obviously not a computer in the traditional sense, but it does have microprocessors, memory and is re-programmable through firmware upgrades. It's primary purpose is to decode the transmissions it receives so, by any definition of the word, it is a computer.

In most languages where does a local variables scope begin and end?

A local variable only exists within the scope in which it is declared. As soon as the scope ends, the variable ceases to exist.

{ // beginning of a scope, i does not yet exist

int i = 42; // local variable declared, i now exists

} // end of scope, i no longer exists

How do you find the product of all the items in a list box using visual basic?

Don't use a list box for this. The purpose of a list box is to present a list of items from which a user can make a selection. That's clearly not what you are trying to do. Use an array instead (you can always construct a list box from an array if required):

Dim values As Integer() = {5, 3, 6, 4, 2}

Dim product As Integer = values(0)

For index = 1 To values.GetUpperBound(0)

product = product * values(index)

Next

Debug.WriteLine(product)

' output

' 720

Note that the for loop starts at index 1 rather than index 0. This is because the value at index 0 is already stored in the product variable and you want to multiply that value by the indexed value to create a new product. Thus on each iteration of the loop, the product accumulates.

How is the protection from a skilled hacker different from an unskilled hacker?

What makes a skilled hacker is the amount of knowledge he has and how good his creativity is, imagine playing chess against a skilled and clever player rather then playing chess with an unskilled player.

What type of transmission is measured by baud rate?

The speed of any type of digital data transmission can be measured in baud. However this unit is usually applied only to serial communication channels carried via a single line (thus can only have one state at each point in time). While this unit is not usually applied to parallel communication channels carried via multiple lines (thus can have a different state on each of these lines at each point in time, making the actual baud rate of the channel the number of lines multiplied by the baud rate of one line).

Baud = state changes per second. Not bits per second!!

An example is the telephone modem. Because the bandwidth of a telephone signal is limited to 3KHz, the maximum possible speed is 2400 baud. However much higher bit per second rates are possible by using very complicated states (e.g. different signal amplitudes, different signal phases) and sometimes data compression algorithms.

For example with 4 different amplitudes and 4 different phases that can be used to represent a state, 16 different states (4 bits) can be transmitted for each baud. This would allow a telephone modem (limited to 2400 baud by the bandwidth limitation of the telephone line) to transmit 9600 bits per second.

For example with 8 different amplitudes and 8 different phases that can be used to represent a state, 256 different states (8 bits, 1 byte) can be transmitted for each baud. This would allow a telephone modem (limited to 2400 baud by the bandwidth limitation of the telephone line) to transmit 19200 bits per second.

What is the demand of mobile application developers in India?

Mobility is the future and that's why the demand of mobile application developer in India is increasing day by day. Its not only in India but also in all the growing and developed economies. USA, UK, Germany, Middle East, Africa and Singapore have seen great rise in demand of mobility solutions, which is bound to grow.

Which Programming Language is more secure Java or Visual Basic 6.0 to develop an IDE?

Visual Basic 6.0 is far too old to develop modern software (support was dropped in 2008). While it can still be used to develop programs, you'd be limited to 32-bit Windows only. That said, there's no reason why an IDE has to be 64-bit.

Java is the better choice of the two. However, Java is an interpreted language (the source compiles to byte code which then has to be interpreted) and is therefore slow compared to native machine code programs. However, it is up-to-date and the compiled byte code is portable. It is assumed that your IDE will make use of existing compilers, linkers, interpreters and other programming tools since these need to be machine-coded to ensure best performance. You certainly wouldn't want to write an interpreter in Java since the interpreter itself would need to be interpreted.

What is interpolation in cnc?

Interpolation is a term borrowed from the mathematics field of numerical analysis. Typically the machine tools that are numerically controlled by computer in CNC applications are capable of moving only in discrete, albeit small steps, rather than continuous motion. However, we want many machined objects to have curved surfaces. To make this possible, curved surfaces are approximated using numerous short steps. Interpolation is the mathematical process of calculating approximate points between fixed points on the desired machined surface. Once these are determined the CNC machine is set to work making its cuts between the fixed points and the interpolated points essentially. Various interpolating functions can be used, the simplest being line segments. More sophisticated machinery is capable of circular interpolation.

Please see the links.

What is Turbo C download used for?

Turbo C is a compiler for a general purpose computer programming language called C. It transforms code written in C into the computer language needed for executable programming.

What is ghz in computer language?

Gigahertz is equal to 1,000 megahertz and is used in measuring speed of computer processing.

Can all computers display HTML5 code?

See, HTML 5 is the latest web language and nearly all the famous web browsers are supporting it. So, if your computer is capable of running that browser version then it can obviously display it.

What laptop can do video editing and school work the best with a quiet fan fast speeds and relatively inexpensive Please help Student in need?

As far as I've been told? I was majoring in graphics and design and I asked the same thing. And a bunch of my tech buddies said that Adobe's Photoshop and video editing is best used on a Mac. Now I don't mean to burst your bubble when I say that because I know that they're expensive laptops but that's the truth to it because the actual fact to that is that Mac's were there first when I came to Adobe, they were able to run it before PC's. But now that PC has caught up to Macs there's really no difference. So I'd say get a Mac but if you want to go cheap? get a PC they run just as good. But the only thing id worn is that jobs for video and photo editing intend to use macs the most so if you go for one of those jobs they'd probably want you to use a mac and not a Windows 7, 8 pc

What is the same track on each platter?

A cylinder. Each track on each platter can be thought of as being a ring, thus if you isolated the same track upon each platter you'd have a stack of imaginary rings which would therefore form an imaginary cylinder.

What is rls algorithm?

The Recursive least squares RLS adaptive filter is an algorithm which recursively finds the filter coefficients that minimize a weighted linear least squares cost function relating to the input signals. This is in contrast to other algorithms such as the least mean squares LMS that aim to reduce the mean square error. In the derivation of the RLS, the input signals are considered deterministic, while for the LMS and similar algorithm they are considered stochastic. Compared to most of its competitors, the RLS exhibits extremely fast convergence. However, this benefit comes at the cost of high computational complexity.

Which encoder creates ASCII?

ASCII (American Standard Code for Information Interchange) is a character-encoding scheme that was standardised in 1963. There is no encoder required to create ASCII. Every machine supports it as standard, although some implement it via UNICODE. The only difference is in the number of bytes used to represent each character. The default is one byte per character yielding 128 standard encodings that map exactly with the first 128 characters in UNICODE encoding.

What is the difference between Ada cobol and c language?

It is something like the difference between ship, car and air-plane: they are hardly similar in any aspect.