Data Structure in C++
Data structures are used to store data in a computer in an organized form. Here we discuss all data structure in c++ like, linked list, stack, queue, tree etc. Here we discuss about data structure in C++.Following Data Structure available in C++
- Stack
- Queue
- Linked List
- Tree
Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory.
Data structures can implement one or more particular abstract data types, which specify the operations that can be performed on a data structure and the computational complexity of those operations. In comparison, a data structure is a concrete implementation of the specification provided by an ADT.
Example of POP Operation in Stack
#include <iostream> // std::cout
#include <stack> // std::stack
int main ()
{
std::stack<int> mystack;
for (int i=0; i<5; ++i) mystack.push(i);
std::cout << "Popping out elements...";
while (!mystack.empty())
{
std::cout << ' ' << mystack.top();
mystack.pop();
}
std::cout << '\n';
return 0;
}
Output
Popping out elements... 4 3 2 1 0For read more you can try these things;
C++ Data Structure, C++ Data Structure for class 12th
No comments :
Post a Comment