can anybody tell why it is not working ? how can i get the time complexity graph ?
Type: Posts; User: blue_gene
can anybody tell why it is not working ? how can i get the time complexity graph ?
>x is the value of n, say 10,20,50,100,200,500,1000,......
>y is time, how long it took to deal with a sample size of your chosen 'n'
here i tried this way...but failed.
#include<stdio.h>...
thanks for clearing my doubts.
but i dont follow how do i plot the complexity of the graph...
>>From a pragmatic point of view, you run your code with lots of values of n, and attempt to plot...
hi salem....you are saying n is the number of data elements.
but in this code,
for ( i = 0 ; i < n ; i++ )
This is O(n)
n may be a simply loop invalidation index instead of
here is a very fundamental question.... many a times i have seen if anybody wants to talk about performance of a code then they refer time complexity . what exactly does it mean ?
my confusions...
thanks salem.....you are right. i found that mistake. now it is ok
i am getting "debug assertion failed " while running code. what does it mean ?
the messages are .....
debug assertion failed !
program c:\sss\debug\sss.exe
File fprintf.c
line 56
>>"const T &" is not a pointer, it's a constant reference to type T.
....hmmm.
thanks.....you guys are very helpful and cordial. i understand where i was wrong......i learned a lot. its ok.
>>if you create a vector of int then you push back an int, if it's a float then push_back float, if it's MyObject then push_back MyObject, if it's a container for pointers to MyObject then push_back...
i am so sorry. its working. may be that was a bad copy.i checked again. this time its working.
did you notice push_back() is taking a pointer p . but when i usued pointer p in my original...
g++ compiler....
>>I believe alphaoide's solution will work.....
its giving compile error. i already checked that in my system . i copied and pasted.
edit: i have ideas on ur example. i was curious to know...
just a quick question by looking ur code.
int num = 10;
vector<int*> vec;
vec.push_back(&num); // u r sending a pointer(address ) but push back demands alias . pointer(here by using & )...
no that code was an example. my las question was not meant for that.
forget about my code.
my question > is it possible to create a vector<some_type *> ?? how do i insert pointers into the...
ok,....it is written void push_back( const TYPE &val );
so, pass by reference (alias).
i have written a small code to see the behaviour...
#include<iostream>
#include<vector>
hi, is push_back() a overloaded function?
bcoz, probabily push_back() accepts simple argument and also pointer both.
is it a overloaded function ? if so, is there any other way acceptance...
....but this is giving multiple beeps in my system.
#include<iostream>
using namespace std;
int main()
but this code is working !!
#include <iostream>
using namespace std;
int* func(int* y);
int main()
{
int m = 4;
hello , can anybody say what was wrong in arian's code ? which line is wrong ? is it when the function returning ??
can u point out the mistake in that code ?
thanks jlou and elad ....i read ur explanation. you have explained well. i have got some more questions reading your material.
questions are....
>>If you passed the stream in like you did the...
hi, i have some idea about operator overloading . in fact i have practised one sample program for addition of complex number by overloading '+' operator. those were simple program to implement and...
>>>I do a lot of right-shift or left-shift when I'm trying to optimize code by getting rid of pesky division/multiplication operations
...but that is limited. is not it ? bcoz bit shifting means...
hunter, i dont have any idea about window API. so your code is out of my bound . i was expecting a simple example.
in fact i was expecting a simple bit level example. i think it is only for...
what is |= operator ? how it works ? can anybody give simple example ?
is it a bitwise OR operator ?
for example var1 = var1 | something
when i should use it ?
hi salem..i tested the code.
output
-----------
g++ t.cpp
./a.out
0xbfffe560 0xbfffe560 // same address
thanks for that solid code. your answers are always to the point .....thanks...