Thanks for the prompt reply. I have already gone through the above link.
However was not able to get any advantage of using vectors over dequeue. So was wondering what could be situation where vectors can be more efficient than dequeue?
User Profile
Collapse
-
How are STL Map stored in memory?
How are STL Map stored in memory?
i.e. they are stored in continuous memory like array or stored in a list or like a deque i.e in pages or in binary tree? -
What are the advantages of using STL vectors over STL deque?
What are the advantages of using STL vectors over STL deque? -
How are References internally implemented in C++?
Is it implemented as a constant pointer or in some other manner? -
Ok, Let me modify the code to make it more understandable:
Now this code will print 11 when printf of main will execute. Can anybody please elucidate the reason for the same.Code:func() { printf("Hello World"); } int main() { printf("\n%d",func()); return 0; }Leave a comment:
-
Regarding function default return value?
e.g. The func returns 11 on this execution? Can anyone elucidate its reason?
Code:func() { printf("Hello World"); } int main() { func() return 0; } -
But in that case how would you make sure that when this static public function containing destructor function is called, no objects of the singleton class would be using the singleton class?Leave a comment:
-
Destructor in Singleton class
1. What should be the access specifier for the destructor function in a singleton class?
private, public or protected.
2. How should destroying the object of the singleton be handled? -
Hi Oralloy,
Thanks for your prompt reply. However neither I am a student nor is this any of my homework exercise.
I was reading articles on calculating efficiency and some doubts arose in from there. I am little confused, so have even given the options with them.
I am new to calculating efficiency, so please request you to help me out in clearing my doubts.
Thanks,
Shilpa.Leave a comment:
-
Can somebody tell me the efficiency of the following:
1. Factorial program usinga. Iteration
b. Recursion
2.Will it be O(12) or something else?Code:for(int i = 0; i < 3; i++) { //linear for(int j = 0; j < 4; j ++){ // log (n) //do constant time stuff } }
3.andCode:for(int j = 0; j < n; j *= 2){ //do constant time stuff }
...Code:for(int j = 0; j < n;
Last edited by Nepomuk; Sep 2 '10, 10:14 PM. Reason: Corrected INDENT tags and added CODE tags - please remember to use them! -
Which one is better in performance - a for loop or a while loop?
I wanted to know which one is better in performance between a for loop and a while loop in terms of:
1. memory requirement
2. execution speed
Also wanted to know since recursion functions are not as efficient as for of while in terms of memory requirement and execution speed, what is the purpose of using them in the code? -
What is the requirement of references in C++?
Why do we need references in C++ when we can accomplish the same task with pointers?
Putting it in other words:
What are the advantages of using references over pointers?
How actually is passing using references in C++ is faster and efficient than passing values using pointers?
No activity results to display
Show More
Leave a comment: