How do you find the time complexity of a given algorithm?
Time complexity gives an indication of the time an algorithm will complete its task. However, it is merely an indication; two algorithms with the same time complexity won't necessarily take the same amount of time to complete. For instance, comparing two primitive values is a constant-time operation. Swapping those values is also a constant-time operation, however a swap requires more individual operations than a comparison does, so a swap will take longer even though the time complexity is exactly the same.
List of back end programming languages?
HTML,CSS, Javascripts are few front end programming languages.
What are the difference between greedy algorithm and dynamic programing?
A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that solutions to the subproblems do not have to be known at each stage; instead a "greedy" choice can be made of what looks best for the moment.
What is worst case and average case complexity of linear search algorithm with explanation?
For a list with n elements, the expected cost is the same as the worst-case cost, which is O(n). The average cost will be O(n/2). However, if the list is ordered by probability and geometrically distributed, the complexity becomes constant, O(1). Compare with a binary search which has a cost of O(log n).
How do you implement 1 bit sliding window protocol progamme in c?
server side:
#include<sys/types.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#define SIZE 4
main()
{
int std, lfd, len, i, j, status, sport;
char str[20], frame[20], temp[20], ack[20];
struct sockaddr_in saddr, caddr;
printf("Enter the port address");
scanf("%d", &sport);
std = socket(AF_INET, SOCK_STREAM, 0);
if(std<0)
perror("Error");
bzero(&saddr, sizeof(saddr));
saddr.sin_family = AF_INET;
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
saddr.sin_port = htons(sport);
lfd = bind(std, (struct sockaddr *)&saddr, sizeof(saddr));
if(lfd)
perror("Bind Error");
listen(std, 5);
len = sizeof(&caddr);
lfd = accept(std, (struct sockaddr *)&caddr, &len);
printf("Enter the text:");
scanf("%s", str);i = 0;
while(i<strlen(str))
{
memset(frame, 0, 20);
strncpy(frame, str+i, SIZE);
printf("\nTransmitting frames:");
len = strlen(frame);
for(j=0; j<len; j++)
{
printf("%d", i+j);
sprintf(temp, "%d", i+j);
strcat(frame, temp);
}
write(lfd, frame, sizeof(frame));
read(lfd, ack, 20);
sscanf(ack, "%d", &status);
if(status 0)write(std, "-1", sizeof("-1"));
else{printf("Enter the sequence no of the frame where error has occured");
scanf("%s", err);
write(std, err, sizeof(err));
read(std, str, 20);
printf("Received the transmitted frame: %s\n", str);
}
}
close(std);
}
What is the difference between an algorithm and java code?
In Java programming language, an algorithm refers to a sequence of instructions that have been specified to undertake a particular task within a certain time. An algorithm can take no or several inputs but will generate at least one output.
The function on insertion sort is to insert a value into its proper place using an algorithm automatically. It sorts through an array and puts it in the appropriate order according to absolute smallest element.
What is the difference between HTML and DHTML?
HTML (Hyper Text Markup Language) is the most widely accepted language used to build websites. It is the main structure of a website. It builds tables, creates divisions, gives a heading message (In the title bar of programs), and actually outputs text. XHTML (eXtensive Hyper Text Markup Language) is the same as HTML, except it has a cleaner syntax. XHTML uses the same tags as HTML, so people who know HTML know messy XHTML. New rules apply in XHTML, such as tags always needing to be ended; Tags need to be "Nested" properly, and such. dHTML (Dynamic Hyper Text Markup Language) is not a language, but the art of using HTML, JavaScript, and CSS together to create dynamic things, such as navigation menus.
What are the four basic HTML tags?
The four most basic tags are <html>, <head>, <title>, and <body>. They are necessary for every web page. The fifth most basic is up for debate, because no other tag is absolutely necessary. In my experience, <table> and <p> are also very common.
i s 'kujl
What is computer science and engineering?
Computer integrated engineering is the act of useing computers to preform various jobs for example it can be used to be a vetanary assistant .You are so stupid to even use this this also tha implacations in the manifactur area of the market for example the manifacture if a toilet .
How you can create an object of a class in java?
for creating objects use the new operator along with a call to the constructor. for ex Triangle t = new Triangle(); In this statement the new operator creates a triangle object and the constructor is called which initializes the object and then new returns a reference of the object which is stored in the reference var "t" of type Triangle.
How do you delete last element from link list?
void
delete_last (node **head)
{
node *tmp = *head;
node *prev = NULL;
if (!tmp) {
} else if (!tmp->next) {
free(tmp);
*head = NULL;
} else {
while (tmp->next) {
prev = tmp;
tmp = tmp->next;
}
prev->next = NULL;
free(tmp);
}
return;
}
Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces.
Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {
What does 'API' stand for in Java?
According to Wikipedia:
"An API is an abstraction that defines and describes an interface for the interaction with a set of functions used by components of a software system. The software that provides the functions described by an API is said to be an implementation of the API."
Read more, below.
What are examples of batch processing?
Batch processing enables work to be done simultaniously whilst the workers are able to play football in the courtyard whilst production is taking place. this can occur in the workplace and is highly recommended to anyone who wishes to try this.
An example of batch processing is the way that credit card companies process billing. The customer does not receive a bill for each separate credit card purchase but one monthly bill for all of that month's purchases. The bill is created through batch processing, where all of the data are collected and held until the bill is processed as a batch at the end of the billing cycle.
How polymorphism can be achieved by means of virtual functions in C plus plus?
Virtual functions of a class are functions (methods) that can be redefined in a child class and, through polymorphism, the correct function will be invoked depending on the type of the class involved. Virtual functions are declared with the virtual keyword... class myclass {
... virtual int myfunction(...);
... etc.
} When a class contains at least one virtual function, a static virtual table (vtable) is implemented behind the scenes by the compiler. This table is used to point to the correct implementation for that type of class at run-time. Abstract base classes are a special form of class, where they must be derived. They often declare virtual functions which is the defined interface, but through the keyword "= 0" enforce the requirement that the class be derived, i.e. that the class can not be instantiated directly... class myclass {
... virtual int myfunction(...) = 0;
... etc.
} class mysubclass : public myclass {
... virtual int myfunction(...);
... etc.
}
Which algorithm has some average worst case and best case time?
All algorithms have a best, worst and average case. Algorithms that always perform in constant time have a best, worst and average of O(1).
What is time complexity and space complexity?
"Running Time" is essentially a synonym of "Time Complexity", although the latter is the more technical term. "Running Time" is confusing, since it sounds like it could mean "the time something takes to run", whereas Time Complexity unambiguously refers to the relationship between the time and the size of the input.
Not everybody can do well in computer programming, that is strong in mathematics. It depends on how your mind operates. For example a person that is Very highly dyslexic may be great at remembering things from years ago, but still be extremely bad at using those memories in order to make wise decisions in everyday choices.
This clearly shows that a person with only base skills in one area, doesn't always exceed at being good at other things branching off of that particular area. (i hope this makes since... hopefully somebody can improve this answer.)
A while loop repeats until the condition becomes false, and may never execute:
int a = 4;
while (a > 5)
{
//Do something
}
or
int a = 4;
while (a > 0)
{
//Do something
a--;
}
A = 0x41 = 65
B = 0x42 = 66
C = 0x43 = 67
...
Y = 0x59 = 89
Z = 0x5A = 90
However, note that depending on a particular numeric or bit value for a character is not always portable. It depends on the implementation.
Write an algorithm for addition of two matrices?
Addition of two matrices is simply performed by iterating over all of the elements and adding elements with like indices together. A c code snippet...
for (i=0; i<N; i++) for (j=0; j<M; j++) c[i][j] = a[i][j] + b[i][j];
Write a c plus plus program to sort the names in asecending order using array of objects?
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
int main()
{
std::vector<std::string> str_array = { "John", "Bill", "Alan", "Craig"};
std::sort (arr.begin(), arr.end());
}
Progarm to delete previous node in linked list?
struct LinkedListNode
{
void* data;
LinkedListNode* next;
};
LinkedListNode* head;
LinkedListNode* tmp;
while (head)
{
tmp head->next;
free(head);
head tmp;
}