Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
difference between data structre and algorithm.
#1
what is differnce between itrator and pointer.so please explain this

what is difference between data structre and algorithm.

what is differnce between global variables and static variables and also understand it with the help of examples.

i am waitng your kind response.
Reply
#2
Iterator
In C++, an iterator is any object that, pointing to some element in a range of elements (such as an array or a container), has the ability to iterate through the elements of that range using a set of operators (at least, the increment (++) and dereference (*) operators). The most obvious form of iterator is a pointer: A pointer can point to elements in an array, and can iterate through them using the increment operator (++). But other forms of iterators exist. For example, each container type (such as a vector) has a specific iterator type designed to iterate through its elements in an efficient way. Notice that while a pointer is a form of iterator, not all iterators have the same functionality a pointer has; to distinguish between the requirements an iterator shall have for a specific algorithm.

Data structure is the technique to store data in memory in specified format (in the form of arrays, link lists, trees etc), while algorithms represent the logic that operates on these data structures, data structure represent the data perspective of the system while the algorithm normally present the middle layer e.g. business logic etc.

Static variables are local in scope to their module in which they are defined, but life is throughout the program. Say for a static variable inside a function cannot be called from outside the function (because it's not in scope) but is alive and exists in memory. On the other hand global variables have to be defined globally, persists (life is) throughout the program, scope is also throughout the program. This means such variables can be accessed from any function, any file of the program.
Example:
int x=50;// A global variable, accessible any where in the program. E.g. in display() function etc
int main() {
static int y=40; //Static variable, accessible only in main() function
system("pause");
}

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is the difference among calloc function ,malloc function and recalloc function? Vuhelper 0 34,597 05-31-2012, 01:46 AM
Last Post: Vuhelper
  What is difference among Binary Tree, Complete Binary Tree and Binary Search Tree? Vuhelper 2 4,345 03-18-2012, 12:47 AM
Last Post: Xpert
  Explain the difference b/w Null Pointer and Null Nodes? C++ 2012 Vuhelper 0 1,953 01-06-2012, 12:24 AM
Last Post: Vuhelper
  What is the difference b/w Inorder Traversal and Inorder Successor? 2012 Vuhelper 0 1,790 01-06-2012, 12:23 AM
Last Post: Vuhelper
  what is the difference between 1. Double Right-Left Rotation 2. Double Left-Right Rot Vuhelper 0 2,020 01-04-2012, 10:37 PM
Last Post: Vuhelper
  Abstract data type (ADT) in C++ 2012 Vuhelper 0 7,106 01-04-2012, 10:34 PM
Last Post: Vuhelper
  call by value, call by reference,call by pointer in data structure 2012 Vuhelper 0 4,334 01-04-2012, 10:28 PM
Last Post: Vuhelper
  Balance of the AVL tree im Data structure 2012 Vuhelper 0 1,902 01-04-2012, 10:27 PM
Last Post: Vuhelper
  What is the difference between “object = this->object” and “this->object=object”? Vuhelper 0 4,047 01-04-2012, 10:17 PM
Last Post: Vuhelper
  why we use queues data structure for level order traverse? Vuhelper 0 2,468 11-05-2011, 05:26 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)