sastry.soft
BAN USER- 5 Answers Guys iam trying to learn algor...
Guys iam trying to learn algorithms..time complexities and space cmp..can some one explain me what is big O and omega..poepl say time complexity is O(NlogN) and (n^2)..what does they mean and how this O,log has really to do with time complexities..instead of explaining taking functions like f(n),g(n) please explain me in simple english with example..i dont understand f(n) and logs..im struggling to learn algoriths and complexities but these notations doesnt give any understanding of complexities..plz help
- sastry.soft November 01, 2012| Flag | PURGE
Thanks dude but tell me when the term 'log' comes into picture...like O(logN) or O(NlogN)..what does this log indicate in terms of time complexity.
- sastry.soft November 07, 2012Let me explain this way:
Your dad has a bike and ur his son want to use his bike but it is outdated and u want to modify it the way you want to and ride it...that is, ur dad(class) has a function called Bike and ur using the same Bike(function) but modified/changed and ur using it(overriding). Same bike but now it is changed.... and when we say son it is ur modified bike that shud come into picture ..which has overriden ur dad's old bike
Static is a class variable it is intialized only once...ordinary variables are object specific variables..each object will have its own copy of variables but it is not the case with Static variables..the same static variable is accessed by all the objects of the class(and so called class variable)...and the reason why we use static object variable in Singleton class so that whenever you try create object and since it is a static variable and holds the object reference we check it is NULL if not NULL we return the same reference by avoiding creation of multiple objects
- sastry.soft November 02, 2012Static is a class variable it is intialized only once...ordinary variables are object specific variables..each object will have its own copy of variables but it is not the case with Static variables..the same static variable is accessed by all the objects of the class(and so called class variable)...and the reason why we use static object variable in Singleton class so that whenever you try create object and since it is a static variable and holds the object reference we check it is NULL if not NULL we return the same reference by avoiding creation of multiple objects
- sastry.soft November 02, 2012Static is a class variable it is intialized only once...ordinary variables are object specific variables..each object will have its own copy of variables but it is not the case with Static variables..the same static variable is accessed by all the objects of the class(and so called class variable)...and the reason why we use static object variable in Singleton class so that whenever you try create object and since it is a static variable and holds the object reference we check it is NULL if not NULL we return the same reference by avoiding creation of multiple objects
- sastry.soft November 02, 2012when we have integer divisions say in any software designed for Civil Engineers or Architects..where there may integer divisions and if the user enters the Zero for denomination..the it bcoms divide by zero exception..run time error...such validations can be taken care in those accessors and mutators
- sastry.soft November 02, 2012pl help me to understand..if(*n && *p==*n) condition...what is the meaning of this condition 'if( *n'....what it is being evaluated to...
and if(!(*p || *m || *n))...what are we checking here? how the condition is evaluated here.
in charsTracker[str1[i] - 'a']-- , what will happen in brackets [str1[i]-'a']....i.e why r we doing like this
- sastry.soft November 01, 2012Can we have duplicates in BST?
- sastry.soft November 01, 2012if he still talk about functions f(n) and g(n) that will go for a toss...i need some clear english demonstration..i tried reading mark weiss but could not understand anything
- sastry.soft November 01, 2012As per the question integer class has only one member function input..but u have used one more member function in public section..instead of using one more function in public block..why cant we make code the fn input() as...int input()
{ cout<<"enter integer"; cin>>inte;return inte}..and use this func in division as u used the output fn..we dont have condition that the protected memebr doesnt return int.do we?
why it is O(n^2)..can u plz explain
- sastry.soft November 01, 2012if iam taking string objects cann't i use find function in <string>
str.find(str1)
what is padding and it's significance
- sastry.soft October 17, 2012what do u mean by load time..is that run time ?
- sastry.soft October 17, 2012try with binary search tree
- sastry.soft October 17, 2012a small change to Ashish 5 steps,
In the third step, compare the two elements with each other in the ligther group and the element which is ligther will be the ligther element among 4 elements(of two groups)
eg say gropA -elements wt 10,8 and Gropu B wtv12,6.Now Group A> Group B..so Group B is ligther and if compare 12 and 6..obviously 6 is least elemet among four elemrnts(10,8,12,6). Plz let me if i my understanding is wrong
u said 5 options can u plz number them to understand the question better
- sastry.soft October 16, 2012it can be 1$ as HS said..if i think logical reasoning the diff between these values is constant i.e 20 and hence the next value in the series should be 100(40 60 80 100..)
- sastry.soft October 16, 2012what does the question mean "A*B is minimized" iam not clear with the question"
- sastry.soft October 16, 2012folks what do we mean by taking O(1) time. what does that exactly mean?
- sastry.soft October 16, 2012
#include<time.h>
- sastry.soft November 09, 2012#include<stdlib.h>
#include<stdio.h>
int main()
{
unsigned int a, b, c;
srand(time(NULL));
a = rand();
b = rand();
c = a + b;
if( c < a || c < b)
{
printf("correct");
}
else
{
printf("error");
}
return 0;
}
----
Output:
error