How can you modify an algorithm to get best case running time?
To improve the best case, all we have to do it to be able to
solve one instance of each size efficiently. We could modify
our algorithm to first test whether the input is the special
instance we know how to solve, and then output the canned
answer.
E.g. For sorting, we can check if the values are already ordered,
and if so output them.
instruction set
What is the difference between computer science and computer programming?
Computer Science is the study of problem solving with computers/computational methods.
Computer programming is part of this problem solving process that makes up the field of computer science.
Computer programming is just a small subset of computer science.
Computer science encompasses not just algorithms and programming, but also operating systems, compilers, network protocols, database systems, artificial intelligence, computer generated graphics, types of programming languages, and much more.
Answer:To put it simply, computer science is the study of everything that relates to a computer. It's more scientific with lots of theory, math, algorithms, etc. Since the field is so wide, there are a variety of computer science degree programs you can choose from based on your aptitude, preference, and career goals. For instance, many colleges offer a computer science degree with a choice of emphasis in networking, programming, social media technology, information systems security and more.
Computer programming is a sub-field of computer science and deals with the more practical aspects of designing, developing and writing programs for the Internet, intranet and mobile applications. Information technology degrees will help you focus on understanding computer systems, hone your skills in problem-solving. Since technology keeps changing, finding solutions and seeking faster and better ways systems is always a top priority for industries, private corporations and government agencies.
Difference between malloc and alloc?
alloc is used as header file while using malloc and calloc functions in C prog.
The definition of malloc function is in the alloc.h file.
It's stdlib.h to be more precise
What is a difference between a high level programming language and a low level programming language?
The most basic difference is that the statements in a low level language can be directly mapped to processor instructions, while a single statement in a high level language may execute dozens of instructions.
Low level refers to the fact that this is a machine language, binary in form, generally meaning one low level command = one executed instruction.
The complexity arises when we need to enable a programmer to designate one high level instruction that performs several or many machine (low level) operations.
Low Level Languages: Assembler and Advanced Assembler - see Compiler Languages.
High Level Languages: RPG, COBOL, any that make machine level programming of a computer easier.
What times does a digital clock show consecutive numbers?
-- 1:23
-- 2:34
-- 3:45
-- 4:56
-- 9:10
-- 10:11
-- 11:12
-- 12:13
-- Either 0:12 or 12:34
For each of these, both AM and PM.
10 times per day.
0n the 24-hr system you could also include:
What is Chomsky's classification of languages?
I believe it has something to do with the articulatory aspect (as opposed to other's acoustic and perceptual classifications).
> No, it is not. This is a hierarchy of formal grammars that rule the production of (human, computer, nature, etc.) "assertions". This approach is focused on a generative view of the meaningful sentences: each one of those could be generated by rules defined by a grammar, or syntactical rules. The classification is ordered by levels of expressiveness and complexity. See the related link on Wikipedia for further information.
What is the function of a automatic voltage regulator?
It protects your sensitive electronic equipment from brownouts and over-voltages. Uncorrected voltage fluctuations gradually degrade the life of electronic components, potentially causing premature failure. An AVR not only adjusts voltages to safe levels, but also provides surge protection against electrical surges and spikes and lightning.
Why do you need other programming language other than java?
different languages has different purposes some are low level and some are high level e.g assembly language that is low level(not as a whole) works with machine but java didn't that's why we need other programming languages
What is Polymorphism and inheritance explain with example?
Polymorphism, is an object-oriented programming concept, which relates to the ability to create a variable, function or an object that has more than one form. This allows the object to invoke the correct instance of the variable, function or other object based upon the object type. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.
Here are some links to examples:
C++: http://www.cplusplus.com/forum/beginner/10884/
c#: http://msdn.microsoft.com/en-us/library/ms173152.aspx
Python: http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming
Java: http://www.tutorialspoint.com/java/java_polymorphism.htm
Can an object oriented approach can be used to develop any system?
Yes, an object-oriented approach can be used to develop any system, however, not every problem is best solved with an object oriented approach. There is no value in forcefully fitting one architectural paradigm (e.g. the object-oriented model) onto any problem just because this can be done; a good architect will chose the best tool for a given problem, considering the nature of the problem as well as its constraints.
How many memory variables can be defined in Foxpro?
The same as in other programming languages. A place to store a value. A variable may be of different types, including logical, string, numeric, or date.
Here is an example that uses a variable:
x = 5
? "The square root of", x, " is ", sqrt(x).
In FoxPro, it isn't necessary to declare variables. It is safer, though, in order to avoid conflicts between different modules, to declare the variable (usually with the LOCAL keyword if you use Visual FoxPro, or PRIVATE if you use the old FoxPro 1.x or 2.x).
All variables are of a type which in some languages is called "variant", that is, the type can change at runtime.
What are different types of computer programming languages?
Hi, A class means collection of methods/functions. Method/function accepts parameters, process set of codes which you have written in the module/function and returns the output to the caller. Collection of class is called Class Library. When you complie the Class Library it becomes a DLL. Hope this helps
Why assembly level language is called machine dependent language?
Machine languages are composed of instructions intended to be read directly by the microprocessor (the computer's CPU). The manufacturer of the CPU determines it's "INSTRUCTION SET"
ASSEMBLY LANGUAGE on the other hand IS NOT machine dependent. The same commands ADD, Divide, Move, etc are universal. HOWEVER the ASSEMBLY LANGUAGE has to have an INTERPRETER for EACH CPU, and that will translate the Universal ASSEMBLY language to the MACHINE SPECIFIC code required to program the CPU.
How do you find the lcm of a number?
You need at least two numbers. Example: 30 and 42. Factor them.
2 x 3 x 5 = 30
2 x 3 x 7 = 42
The LCM is the combination of factors, eliminating duplicates.
2 x 3 x 5 x 7 = 210, the LCM
Reverse of a given string using recursion?
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char str[10],temp;
int i,len;
printf("Enter String : ");
scanf("%s",str);
len=strlen(str)-1;
for(i=0;i<strlen(str)/2;i++)
{
temp=str[i];
str[i]=str[len];
str[len--]=temp;
}
printf("%s",str);
getch();
}
Please do give your views on this.
With Regards,
Sumit Ranjan.
Analyst at RMSI Company.
What is the purpose of program counter?
program counter is a register that has the address of next instruction that has to be executed after currently executing instruction. it is used for proper execution of functions of computer by providing address of next instruction to microprocessor.
Open source refers to code that is distributed outside of the manufacturer's company. Microsoft does not allow the code the programmers write for their programs outside of their company, so their code is proprietary, closed source.
OpenOffice allows their code to be used by others. The reason for this is so that others can make improvements and customized enhancements.
Open source is almost always free, where proprietary software has to be paid for, and is sometimes quite expensive.
What are the differences between pass and phase in compiler?
When we talk about the phases we talk about the steps compiler should do in order to finish it job. For example phases could be creating local variables symbol table, generating parsing tree, lexical checking, optimization, etc.
When we talk about passes we talk about times some operation was repeated. For example there are 2-passes Assembler compilers. It means that before giving the results it repeats some steps twice, most of time times optimization step. The more passes you put the better quality result you get. The same applies to music and video encoding.
For example:
Source code:
i++;
i++;
i++;
1st step (pass):
i = i + 1;
i = i + 1;
i = i + 1;
2nd step (pass):
i = i + 3;
Most of compiler before generating results converts source code some kind inner language that is easier to parse, check in later steps.
As you can see two-pass compiler would generate better quality code, than one-pass compiler, but the first one would be faster to compile.
What is the difference between pthread and thread?
Answer POSIX threads are fairly portable. They can be emulated on uniprocessor systems at a slight (or sometimes no) penalty in speed. On shared memory multiprocessor machines, there is often kernel support for threads; this means that your application can take full advantage of all available CPUs and achieve (near) maximum performance. It is important to point out that threads libraries are predicated on shared memory. Threads won't help you on distributed memory machines Preeti
What are electronic and mechanical equipment called?
Digital circuits are the most common physical representation of Boolean algebra and are the basis of all digital computers. Computer's industrial processes are constructed of digital circuits.
What year was the internet developed?
The first internet like network was probably the ARPANET.
In August 1962 computer scientist J. C. R. Licklider, sent out a memo, discussing the idea of an "Intergalactic Computer Network". The ideas in this memo are still used in todays internet. J. C. R. Licklider went on to work with the Advanced Research Projects Agency (ARPA), a division of the US Department of Defense. He helped with the ideas for what became the ARPA Network or ARPANET. The ARPANET's purpose was to link computer science departments at various universities, to improve the deliver of computing results. The contract for it's construction was given to BBN Technologies on 7 April 1969. ARAPANET's first version was completed within 9 months.
Tim Berners-Lee is often credited for creating the internet. In fact he and his team only created a mark-up language called Hyper-Text Mark-up Language or HTML and the protocol for it's transfer known as Hyper-Text Transfer Protocol or HTTP. HTML was simply a way of creating text documents that can link to other documents. This was called a hyper-link. Other tags were added to HTML through it's development to allow for images, input fields, raster plugins, applets and much more to allow more of the functionality we have in today's websites.
In 1980 Tim Berners-Lee, a physicist at CERN proposed and built a prototype of a system for sharing documents called ENQUIRE. In 1989, Berners-Lee wrote a memorandum proposing an Internet-based hypertext system. He finished a writing a HTML browser in 1990. In November 24, 1995 the first official HTML protocol was published.
So the answer is the ideas for the physical network began in 1962 and were realised in 1969. The ideas for today's de-facto internet document HTML began in 1980 and were made official in 1995.
The main advantage is that it gives the programmer the opportunity to examine the resultant assembly and manually optimise the code. A mature compiler can often produce high quality machine code, however there are still some rare but non-trivial cases where manual intervention is required to achieve optimal performance.
How many essential functions are required to write a c program and write those?
One.
int main (void) { return 0; }
How do you write a program to sort an array using selection sort?
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n,i,j,temp,a[50];
printf("Enter how many elements=");
scanf("%d",&n);
printf("Enter %d elements",n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<=n-1;i++)
{
for(j=1;j<=n-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("\nSorted Array:\n");
for(i=1;i<=n;i++)
{
printf("\n%d",a[i]);
}
getch();
}