Why is the Bubble Sort algorithm also referred ro as Sink Sort?
Bubble sort got its name because if you could watch the way your data was changing, on each iteration you would see the greatest number "bubble" to the top.
Similarly, you could said that you would see the lowest number "sink" to the bottom.
Lint is suspicious or non-portable code. Lint is also the name of a program that looks for suspicious or non-portable code.
Augusta Ada King, Countess of Lovelace (1815 - 1852), born Augusta Ada Byron and now commonly known as Ada Lovelace, is credited with writing the first recognisable algorithm intended for processing by a machine, Charles Babbage's Analytical Engine, in 1843. She is therefore known as the world's first computer programmer.
The programming language Ada is also named after her.
What is the difference between an integer and a Boolean variable?
An integer stores a whole number. The exact range depends on the language; in Java, "int" stores whole numbers in a range of approximately minus 2 billion to plus to billion.
A boolean variable, on the other hand, stores only one of two values - these are often called "true" and "false" (as in Java). Boolean variables are often used to keep track of information that can be thought of as a reply to a "yes/no" question. For example, to mark whether a certain item is active or not you have only two choices, so it makes sense to use a boolean variable.
What is the program to compute calendar?
#include<iostream>
#include<iomanip>
#include<string>
#include<sstream>
bool is_leap_year (unsigned year) { return !(year%400) (!(year%4) && (year%100)); };
unsigned count_leap_years (unsigned year) { return year/4-year/100+year/400; };
unsigned day_of_year (unsigned y, unsigned m, unsigned d);
unsigned long long count_days (unsigned y, unsigned m, unsigned d) {
return 365ULL * (y-1) + count_leap_years(y-1) + day_of_year (y, m, d);}
// compute day of year (January 1st == day 1)
unsigned day_of_year (unsigned y, unsigned m, unsigned d) {
static int DayOfMonth[] = {0,31,59,90,120,151,181,212,243,273,304,334};
return DayOfMonth[m-1] + d + ((m>2 && is_leap_year(y))? 1 : 0);
}
std::ostream& centre_text (std::ostream& os, std::string& str, size_t width) {
if (str.size()<width) {
unsigned spaces {(width-str.size())/2};
while (spaces-->0) os << ' ';
}
return os << str;
}
std::ostream& calendar(std::ostream& os, unsigned y, unsigned m)
{
using namespace std;
string Month[] {"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"};
string Week {"Su Mo Tu We Th Fr Sa"};
unsigned DayOfMonth[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (is_leap_year (y)) DayOfMonth[1] = 29;
stringstream ss {}; ss << y; // convert year to string
string s {Month[m-1] + ' ' + ss.str()};
os << endl;
centre_text (os, s, Week.size()) << endl;
os << Week << endl;
unsigned first_day {count_days (y, m, 1) % 7};
for(unsigned i {};i<first_day; ++i)
os << " "; // three spaces
for(unsigned i {first_day}, day {1}; day<=DayOfMonth[m-1]; ++i, ++day) {
os << setw(2) << day << ' ';
if(i%7==6) os << endl;
}
return os << std::endl;
}
int main(void){
unsigned year,month;
std::cout << "Enter the month and year: ";
std::cin >> month >> year;
calendar(std::cout, year, month);
}
What is difference between compiled code and uncompiled code?
Probably that one is compile and the other isn't. - A programmer writes a computer program in a programming language that is more or less readable - at least to the programmer. This is called the "source code". This is then converted (compiled) into the so-called "machine language". The machine language can't be read by a human, unless a lot of effort is devoted to decoding it - but it is what the computer is designed to run.
Different parts of the C language?
Lexical elements are groups of characters that may legally appear in a source file. Common categories for lexical elements are keywords, numeric and alphanumeric constants, variable references and special tokens, but the exact categorization is subject to the compiler's implementation.
Why you call as cousins of compiler?
"Cousins" of the compiler are those things related to the compiler, and may or may not be part of the compiler. This includes: preprocessors, assemblers, linkers, and interpreters.
What is the difference between state table and truth table?
A state table defines the behaviour of the of the sequantial function
Write a c program to display 1 4 9 16..100?
#include
main(){
int i = 0;
int counter = 1;
while(i <= 100){
i = counter*counter;
counter++;
printf("The value of i is:%d\n", i);
}
exit(0);
}
END CODE
I think this should work and display the results in the terminal. I haven't tried it though, so it might not work.
Answer:#includeint main (void) { puts ("1 4 9 16..100"); retun 0; }
What are high level programming languages?
A '''high level language''' is a computer language that is more easily understood by a human being than a computer. As opposed to low and intermediate languages (like assembler or binary) a high level language has to be translated or compiled into a format that can be understood by the processor. Examples of high level languages are BASIC, ForTran and CoBOL.
The term high-level language is merely an indication of the level of abstraction between the programming language and the architecture.
Machine code (a specific sequence of 1s and 0s) is the native language of the computer, and is specific to each architecture (PC, Mac, mobile phone, tablet, PIC, etc). Before there were any computer languages, all computer programs were input as a sequence of machine code, which was prone to error and extremely difficult to debug.
Assembly language was, arguably, the first computer language, and is extremely low level. Every architecture requires its own assembler, where every CPU instruction is mapped to an easy to remember mnemonic. This made programs easier to read and therefore maintain. Since there was no abstraction between the symbolic language and the resulting machine code, assembly is considered to be a low-level language.
After the introduction of assembly instructions, high-level languages began to appear. These added another level of abstraction between the language and the architecture, such that a single symbolic instruction could easily produce dozens of assembly instructions. This simplified programming making it all the more easier to read and maintain.
Although all symbolic languages apart from assembly are considered to be high-level languages, there are differences in the degree of abstraction. C/C++ and its variants have a relatively low degree of abstraction because they have low-level features such as direct memory access and can access the specific architectural features of the CPU. They also compile to native machine code which can be further tweaked with assembly to produce highly-efficient machine code specific to the intended architecture. By contrast, Java has a high degree of abstraction because it compiles to byte code which must be translated by the Java virtual machine (JVM) within which the byte code executes. Although this makes Java code highly-portable (code will run on any platform with a JVM, without the need for any code changes), the need for the JVM itself adds an extra level of abstraction, which means there is very little interaction between the original code and the architecture itself. In other words, a Java program cannot compete with C++ for performance.
What is a brief history of Artificial Intelligence in one paragraph?
Artificial intelligence has had a rocky history. In 1956 Herb Simon, one of the discipline's four founders, claimed "Within 20 years, computers will be able to do anything a man can do." Yet many of the things we think of when we think of true artificial intelligence - such as understanding nuanced language, solving novel problems, learning through experience and being able to use that knowledge - are just starting to be real phenomenon.
It's important to differentiate between strong AI - which requires sapience and logical reasoning abilities - and weak AI, which merely tweaks the software, or uses specialized programming languages, to create a program tailored to the narrow function required. Strong AI is a lot more difficult to program and requires innovative methods of computing.
Back in the day (aka 1950), Alan Turing published his paper Computing Machinery and Intelligence, and was in support of the functionalist approach to AI (machines can be considered "thinking" if their behavior is comparable to human behavior). The famed "Turing test" for AI involves a human subject who attempts to guess if they are interacting with a person or a machine (over the computer or via writing).
The most famous counter-argument is John Searle's "Chinese room" thought experiment. In theory, a man who does not speak Chinese could sit in a room and receive text queries, written in Chinese, from other people just outside the door. The man could then follow a series of steps using the input and generate a reasonable reply without have to have understood any of the actual meaning. A computer program that passes the Turing test may appear to be carrying on a real conversation while having no actual comprehension, just as the man in the "Chinese room" does not actually understand any Chinese.
The trick, it seems, is to program a system that DOES understand what is passing through it. Understanding raises interesting yet somewhat unanswerable questions about consciousness, memory, learning, and the will to do something unique with the knowledge acquired. This discussion becomes very abstract very fast, but different approaches to AI are advancing our understanding of what computers are and what they are capable of being.
Write an algorithm to swap the values of two variables?
x=9;
y=4;
x=x+y; #x=13;y=4;
y=x-y; #y=13-4=9;
x=x-y; #x=13-9=4;
there are 4 phases in instruction cycle
fetch
decode
execute
store
A logical operator representing the intersection of two sets?
There is no built-in logical operator that can achieve this. Logical operators operate upon Boolean operands (true and false) and output a Boolean value. Converting a set to a Boolean value won't tell us which individual elements exist within that set and without that vital information we cannot represent the intersection of two such sets.
To represent the intersection of two sets we need to represent the "universe of elements" as a bitmap, where each bit represents exactly one element of the universe. If the universe has 10 elements then we need a bitmap of 10 bits:
1111111111 = universe of elements
Note that a bitmap is nothing more than a binary value.
We can then represent the sets, A and B, as subsets of this universe:
A = 1011011011
B = 0101101101
If we perform a logical AND (operator &&) these binary values would implicitly convert to Boolean values. Given that both values are non-zero, they will both convert to true and the result would also be true:
C = A && B; // e.g., C = true && true = true
This would only tell us that an intersection exists, it will not tell us what the intersection actually is.
However, if we perform a bitwise AND (as opposed to a logical AND), we can determine which individual bits are present in both sets:
C = A & B; // e.g., C = 1011011011 & 0101101101 = 0001001001
Here we can see that both sets contain the 1st, 4th and 7th elements of the universe (starting from the low-order bit, reading right-to-left).
The built-in logical AND operator can only accommodate as many bits as will fit in a word. If the machine supports 64-bit operations, then the universe of elements is limited to 64 elements at most. If we have a larger universe, we cannot use built-in operators and must provide a named function instead. First, let's define a variable length set of integers as an array:
struct set {
int* data; // pointer to an array of integers
size_t size; // length of the array
};
Now we can define an intersect function:
set intersect (set A, set B) {
set C;
C.size = A.size>B.size?A.size:B.size; // use the larger of the two set sizes
C.data = malloc (C.size * sizeof (int)); // allocate memory
C.size=0; // start at index 0
for (int i=0; i<A.size, ++i) {
for (int j=0; j<B.size, ++j) {
if (A.data[i] == B.data[j]) C.data[C.size++] = A.data[i];
}
}
C.data = realloc (C.size * sizeof(int)); // shrink the array (remove unused elements)
return C;
}
This is clearly less efficient than using the built-in operator &. However, we can possibly improve the efficiency by converting the sets to bitmaps and dividing those bitmaps into groups of bits that the built-in operator can accommodate efficiently (such as 32-bit groupings), however the conversion processes also have to be taken into account to determine whether the overall efficiency is improved. This is left as an exercise for the reader.
i think that my answer is izmir university :)
Can hummingbirds open their beaks?
Sure, but only a little. Most live on nectar, which they basically lap up, so they only need to open their beaks enough to get their tongues out.
Is equinox using open source software?
equinox infractructure can be with llinux operating systems, mysql and other open source softwares, it is a matter of choice according to the banking requirements.
Pascal program determine the age of 2 friends?
the age of 2 friends
determine if the age greater than 18 if not write the output statment you can vote
if younger than 18 print you should be in school
What are the factors that influence the performance of algorithm?
The performance of an algorithm depends primarily on two concepts: concurrency and number of operations per input unit. Concurrency occurs when an algorithm can split its data into parts and work on each part in parallel, such as a binary sort algorithm that uses "threads" to break its work into equal loads. JPEG algorithms can operate on 8x8 blocks of pixels, and are well-suited to concurrent algorithms, while solving a long algebraic equation may not be suitable for concurrent operation if the results of each step determine the following step.
The second factor of performance is known as the Big-O notation. This is summarized as an algorithm's response to the size of the input, where O(1) is fixed time (and fastest), and O(n) is a linear increase to input size, and larger values, such as O(n^2) representing exponential growth of processing time dependent on input size, or O(n!) representing factorial growth (very poor scaling). Other models that represent scaling also exist, but Big-O appears to be one of the most common models for conveying the cost of an algorithm.
What tools automagemanage and simplify development process for programming?
IDE (Integrated Development Environment). IDEs are composed of the editor environment, which can invoke the compiler and linker automatically, a source formatting tool, a debugger, and numerous other "house-keeping" functions that are useful to have, all in one package.
What is the error in this SQL statement?
You need to tell us what the statement is - in order for us to help you !