Sie sind auf Seite 1von 3

1.

Linked lists
a. Polynomials : We use linked lists to perform operations on polynomials , and
we use it to to store the coefficient and the exponent.
b. representing sparse matrix :
This is the way to save time and resources of the computer by reducing the
number of operations which have zero elements.

2.Stacks

a. blank sheets of paper in a printer tray : when we put papers in
printer one above another and when we print it takes the one on
the top .
b. books in a library : which means a book is added on top of a pile of
books, while removing a book from a pile also takes the book on
top of a pile.
c. Stack is to reverse a word : You push a given word to stack - letter
by letter - and then pop letters from the stack.
d. Undo mechanism in text editors: this operation is accomplished by
keeping all text changes in a stack.
e. Bread bag : when bakery puts the bread loaf in the bag and when
we take the bread we take the one on the top.
3. Queues
a. A line in bank : when we go to bank , we take turn , the first to
come is the first to go .
b. a line of student in schools : when students go to school they take
turns the first come the first in .
c. Pipes : when water gush from the first side out first from the
another side
d. Printer tasks : when the printer take a many tasks prints the first
task first .
e. record a song : when we record a song the voice record first we
hear it first .


4. Trees
a. Family tree : a tree that show the relations between many people
.

b. Searching procedure : You search for job openings at the United
Nations using the search engine on this website. Most job
openings are for a specific position in a particular office and duty
station but there are also so-called generic job openings.
c. binary tree : Describing a set of numbers in a sorted way
5. Graph

a. Graph : used to draw mathematical graphs in a coordinate
system. Anyone who wants to draw graphs of function .
b. Describing the distances between cities : and we can put
some details like distances.
c. Describing the position of rooms in a building like a building in a
college
d. Networks of communication : graphs are used to represent
networks of communication, data organization, computational
devices, the flow of computation
f. study molecules in chemistry and physics so by using graphs
understanding become easier .






#include <iostream>
#include <string>
using namespace std;
void inc(int *p , int *q ){
int *cur = p ;
while (cur != q) {
++(*cur ) ;
++cur ;

}
void prin(const int *p , const int *q );

int main(){
int a[] = {10 ,20 ,30};
inc (a , a+3) ;
prin(a ,a+3);
system ("PAUSE");
return 0;

}
void prin(const int *p , const int *q ){

const int *cur = p ;
while (cur != q) {
cout << *cur <<endl ;
++cur ;

}
}


int *a , *b ,*c ,*d ;
a=new int[7];
a+5 =6 ;
*d =(*(a+5) +16 );
c=a+9;
cout <<b ;

Das könnte Ihnen auch gefallen