Download
1 / 118

HERE IS THE BASIC IDEA: - PowerPoint PPT Presentation


  • 72 Views
  • Uploaded on

HERE IS THE BASIC IDEA:. do. re. mi. myLinked. myLinked. head length. 3. NULL. do. re. mi. myLinked. myLinked. head length. newHead. 3. ?. ?. do. re. mi. NULL. myLinked. myLinked.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' HERE IS THE BASIC IDEA:' - hyatt-suarez


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

myLinked. myLinked.

head length

3

NULL

do

re

mi


myLinked. myLinked.

head length

newHead

3

?

?

do

re

mi

NULL


myLinked. myLinked.

head length

newHead

3

ti

?

do

re

mi

NULL


myLinked. myLinked.

head length

newHead

3

ti

do

re

mi

NULL


myLinked. myLinked.

head length

newHead

4

ti

do

re

mi

NULL


AN ITERATOR IS AN OBJECT THAT

ENABLES A USER TO LOOP THROUGH

A CONTAINER WITHOUT VIOLATING

THE PRINCIPLE OF DATA

ABSTRACTION.


template<class T>

class Linked

{

protected:

struct Node { T item; Node* next; }

Node* head;

long length;

public:

class Iterator

{

friend class Linked<T>;

protected:

public:

} // class Iterator

} // class Linked


Linked<string> words;

words.push_front ("mellow");

words.push_front ("placid");

words.push_front ("serene");

Linked<string>::Iterator itr;

itr = find (words.begin( ), words.end( ), "placid");

if (itr == words.end( ))

cout << "word not found" << endl;

else

cout << "word found" << endl;


int scores [5];

for (int i = 0; i < 5; i++)

scores [i] = 20 * i;

if (find (scores, scores + 5, 35) == scores + 5)

cout << "score not found" << endl;

else

cout << "score found" << endl;


ad