What are the Advantages of binary search on linear search in c?
(i) Binary search can interact poorly with the
memory hierarchy (i.e. caching), because of its
random-access nature. For in-memory
searching, if the interval to be searching is
small, a linear search may have superior
performance simply because it exhibits better
locality of reference.
(ii) Binary search algorithm employs recursive
approach and this approach requires more stack
space.
(iii) Programming binary search algorithm is
very difficult and error prone (Kruse, 1999).
What is object oriented programming and visual basic.net?
Yes, Visual basic uses Objects. I.E. buttons, options buttons, forms, text boxes, these are all objects in VB. VB also allows the creation and use of COM classes.
Visual basic is partially OOP as it does not support implementation inheritance, which is usually a feature of an object-oriented language.
What is the first in first out data structure?
In computer programming, first-in first-out (short FIFO) describes a data structure which implements a chronological order, such that when multiple elements are added to the data structure, the normal retrieval method returns the elements in the order in which they were added.
FIFO structures are often used to implement queues and buffers. The alternative commonly used chronological sorting container is LIFO, short for last-in first-out.
How do you compute the nth Fibonacci number using VBScript?
<html>
<body>
<script type="text/vbscript">
Dim a, b, c, n, nth
a = 0
b = 1
n = Cint(InputBox("Enter the value of ""n"""))
For nth = 1 to n Step 1
Document.Write(b&"<br/>")
c = a + b
a = b
b = c
Next
</script>
</body>
</html>
How do you draw a flowchart using case statement?
double discount; // Usually code would be read in char code = 'B' ; switch ( code ) { case 'A': discount = 0.0; break; case 'B': discount = 0.1; break; case 'C': discount = 0.2; break; default: discount = 0.3; } System.out.println ( "discount is: " + discount );
What programming language does YouTube use?
If your are thinking of youtube it uses a variety of languages. It defiantly uses flash and JavaScript for its front end and some sort of SQL for its data base. It uses several other languages too but those listed above are the only ones I am sure of.
Write an algorithm for quick sort?
#include <stdio.h>
#include <stdlib.h>
#define size 50
void swap(int *x,int *y)
{
int temp;
temp = *x;
*x = *y;
*y = temp;
}
int partition(int i,int j )
{
return((i+j) /2);
}
void quicksort(int list[],int m,int n)
{
int key,i,j,k;
if( m < n)
{
k = partition(m,n);
swap(&list[m],&list[k]);
key = list[m];
i = m+1;
j = n;
while(i <= j)
{
while((i <= n) && (list[i] <= key))
i++;
while((j >= m) && (list[j] > key))
j--;
if( i < j)
swap(&list[i],&list[j]);
}
// swap two elements
swap(&list[m],&list[j]);
// recursively sort the lesser list
quicksort(list,m,j-1);
quicksort(list,j+1,n);
}
}
void printlist(int list[],int n)
{
int i;
for(i=0;i<n;i++)
printf("%d\t",list[i]);
}
void main()
{
int n,i;
int list[size];
printf("How many numbers do you want to enter");
scanf("%d",&n);
printf("Enter the numbers you want to sort");
for(i=0;i<n;i++)
{
scanf("%d",&list[i]);
}
printf("The list before sorting is:\n");
printlist(list,n);
// sort the list using quicksort
quicksort(list,0,n-1);
// print the result
printf("The list after sorting using quicksort algorithm:\n");
printlist(list,n);
}
What causes internal fragmentation?
External fragmentation is the phenomenon in which free storage becomes divided into many small pieces over time.[1] It is a weakness of certain storage allocation algorithms, occurring when an application allocates and deallocates ("frees") regions of storage of varying sizes, and the allocation algorithm responds by leaving the allocated and deallocated regions interspersed.
How do you convert integer to float?
Sure especially in programming. Generally an int can be passed directly into a float.
Examples:
9 is an integer
9.00 is a float
in programming
int A = 9;
Float B = A;
What is difference between macro processor and macro assembler?
A macro processor processes macros. So what do you think a macro call does, play the flute. The answer is in the question and that begs the question of are you suited to computer programming specifically and an education in general. You are showing a marked reluctance to thinking.
In computer science, const-correctness is the form of program correctness that deals with the proper declaration of objects as mutable or immutable. The term is mostly used in a C or C++ context, and takes its name from the const keyword in those languages. The idea of const-ness does not imply that the variable as it is stored in the computer's memory is unwriteable. Rather, const-ness is a compile-time construct that indicates what a programmer may do, not necessarily what he or she can do. In addition, a class method can be declared as const, indicating that calling that method does not change the object. Such const methods can only call other const methods but cannot assign member variables. (In C++, a member variable can be declared as mutable, indicating that a const method can change its value. Mutable member variables can be used for caching and reference counting, where the logical meaning of the object is unchanged, but the object is not physically constant since its bitwise representation may change.) In C++, all data types, including those defined by the user, can be declared const, and all objects should be unless they need to be modified. Such proactive use of const makes values "easier to understand, track, and reason about," and thus, it increases the readability and comprehensibility of code and makes working in teams and maintaining code simpler because it communicates something about a value's intended use. For simple data types, applying the const qualifier is straightforward. It can go on either side of the type for historical reasons (that is, const char foo = 'a'; is equivalent to char const foo = 'a';). On some implementations, using const on both sides of the type (for instance, const char const) generates a warning but not an error. For pointer and reference types, the syntax is slightly more subtle. A pointer object can be declared as a const pointer or a pointer to a const object (or both). A const pointer cannot be reassigned to point to a different object from the one it is initially assigned, but it can be used to modify the object that it points to (called the "pointee"). (Reference variables are thus an alternate syntax for const pointers.) A pointer to a const object, on the other hand, can be reassigned to point to another object of the same type or of a convertible type, but it cannot be used to modify any object. A const pointer to a const object can also be declared and can neither be used to modify the pointee nor be reassigned to point to another object. The following code illustrates these subtleties: void Foo( int * ptr, int const * ptrToConst, int * const constPtr, int const * const constPtrToConst ) { *ptr = 0; // OK: modifies the pointee ptr = 0; // OK: modifies the pointer *ptrToConst = 0; // Error! Cannot modify the pointee ptrToConst = 0; // OK: modifies the pointer *constPtr = 0; // OK: modifies the pointee constPtr = 0; // Error! Cannot modify the pointer *constPtrToConst = 0; // Error! Cannot modify the pointee constPtrToConst = 0; // Error! Cannot modify the pointer To render the syntax for pointers more comprehensible, a rule of thumb is to read the declaration from right to left. Thus, everything before the star can be identified as the pointee type and everything to after are the pointer properties. (For instance, in our example above, constPtrToConst can be read as a const pointer that refers to a const int.) References follow similar rules. A declaration of a const reference is redundant since references can never be made to refer to another object: int i = 42; int const & refToConst = i; // OK int & const constRef = i; // Error the "const" is redundant Even more complicated declarations can result when using multidimensional arrays and references (or pointers) to pointers. Generally speaking, these should be avoided or replaced with higher level structures because they are confusing and prone to error.
On the computer system what is the difference of binary and decimal?
There is no difference. Decimal notation is merely a human convenience. The same rules that apply to decimal also apply to binary, the only difference being that decimal has 10 digits and deals with powers of 10, while binary uses 2 digits and deals with powers of 2. Binary (base-2) is the most primitive form of numeric notation and by far the simplest to implement at the machine level.
What are some of the new roles information system are playing in organization?
A management information system is a system that has important tools to supports, analyse, delivery and adding reliability to any organisation. Also this helps to solve businesses problems. The term MIS is often used to submit to a group of information management methods tied to the support of human decision making, e.g. Decision Support Systems, Expert systems, and Executive information systems.
The RAM is like a dish holder. When required the disk is used and when the process is complete we keep the dishes back in its place again. Imagine the dishes to be empty spaces in the RAM. When a software or a program wants to run then a dish is utilised in the process and when the program is terminated the dish is again placed back in its place so that other programs can utilise the free space.
What are the different types of microcomputers?
) Desktop Personal Computer II) Laptop Personal Computer
III) Palmtop Computer / Personal Digital Assistant ( PDA)
IV) Workstation / Server
What are the function of flowcharts?
Figure 7: Flowchart of the MATLAB function simulate.m.
The flow of each of the blocks is then repeated starting at Numerical Integration for Calculating with . In order to execute the blocks in the flowchart, simulate.m calls upon many MATLAB and C functions, each of which are briefly described below.
The function simulate.m is called by a wrapper function rcvsim.m for execution at the Linux prompt. This wrapper function takes two command line arguments: 1) the name of a file containing the desired parameter values and 2) the prefix name of the output files to be generated in MIT format. The function rcvsim.m, which also includes a help option, reads in the parameter file with read_param.m (see above), creates a header file in MIT format, executes simulate.m, writes the simulated data to MIT format files if the on-line viewing option is not chosen, and displays cardiac function and venous return curves, if desired, with the function plot_cfvr.c (which employs Gnuplot). In order to execute rcvsim.m, the function must be compiled with the filemake.m which creates the binary file rcvsim. The function simulate.m may also be compiled independently of rcvsim.m with the file makem.m which creates the binary file simulate.mexlx (in the Linux environment). Each of these make files greatly improve execution speed specifically through mcc (MATLAB compiler) optimization arguments r (real numbers only) and i(no dynamic memory allocation). Note that simulate.m may only be executed in the MATLAB environment without on-line viewing and parameter updating capabilities.
If circle diameter is 12 what is circumference?
A 12-inch diameter circle has a circumference of: 37.7
Where do you find instances in World of Warcraft?
Instances in WoW are all over the place. Theres one in the Barrens near Thunderbluff, theres one in Westfall, one in Dun Morogh, theres one actually inside a Capital city: Stormwind City. So.... Just look around cause the instances are all over the place.
Why in copy constructor in c you use pass by reference?
Because if it's not by reference, it's by value. To do that you make a copy, and to do that you call the copy constructor. But to do that, we need to make a new value, so we call the copy constructor, and so on...
(You would have infinite recursion because "to make a copy, you need to make a copy".)
How can you use hacking in c program?
That entirely depends on what you want it to do, however it is easy to send commands to the command line using subprocess.Popen(), read files and modify them or back them up using the built in open(), or delete files.
Did this answer your question?
Write an algorithm to find max of 10 numbers?
Someone's coursework?! This function is for an array of integers, the length of the array is Count.
int MaxInt(NumArray as *int, Count as int)
{
int Inst;
int Result;
Result = NumArray[0];
for (Inst=0;Inst
{
if(NumArray[Inst] > Result)
{
Result = NumArray[Inst];
}
}
return Result;
}
Why multithreaded programming is beneficial over single threaded programming?
Not having multithreading is like only having one arm and one gram of brain tissue. Multithreading is essential to computer application operation.
Multithreading allows a computer to:
* Distribute processing power over various applications, allowing multiple programs to run at the same time. * Allow a program to run non-essential processes in the background while the main application continues to run normally without hold-ups. * Manage timing of different events without making the process too complicated. For example, say that you have an application that does text editing and plays music. You would want to run the text editor part and the music playing part on separate threads, because otherwise, when the text editor got to a computation-intensive stage, the music would be slower, and when the text editor was idle, the music would be faster.
This is also what allows the computer to run multiple applications at once. If the computer could not distribute processing power over multiple applications, then you could not run multiple instances of a text editor, or an internet browser, or really anything. Really, nothing would be possible because the system resources would monopolize the processor.
In reality, this is how the processor handles threads: it goes around and devotes some time to each one, then moves on to the next. It "rounds the bases" so fast, like a cathode ray tube TV, that we don't notice the different. Duel (and triple, and quad, etc.) core processors allow one to split the applications and their corresponding threads to operate on different processors, affecting how much processing power they each receive.
Different graphics functions in'C' language?
There are no built in or standard graphics library with the original C language. The BGI library graphics.h has many functions for borland graphics. windows.h is another header file for creating user interfaces in windows.