Here is the basic idea
This presentation is the property of its rightful owner.
Sponsored Links
1 / 118

HERE IS THE BASIC IDEA: PowerPoint PPT Presentation


  • 35 Views
  • Uploaded on
  • Presentation posted in: General

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.

Download Presentation

HERE IS THE BASIC IDEA:

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


Here is the basic idea

HERE IS THE BASIC IDEA:

do

re

mi


Here is the basic idea

myLinked. myLinked.

head length

3

NULL

do

re

mi


Here is the basic idea

myLinked. myLinked.

head length

newHead

3

?

?

do

re

mi

NULL


Here is the basic idea

myLinked. myLinked.

head length

newHead

3

ti

?

do

re

mi

NULL


Here is the basic idea

myLinked. myLinked.

head length

newHead

3

ti

do

re

mi

NULL


Here is the basic idea

myLinked. myLinked.

head length

newHead

4

ti

do

re

mi

NULL


Here is the basic idea

AN ITERATOR IS AN OBJECT THAT

ENABLES A USER TO LOOP THROUGH

A CONTAINER WITHOUT VIOLATING

THE PRINCIPLE OF DATA

ABSTRACTION.


Here is the basic idea

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


Here is the basic idea

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;


Here is the basic idea

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;


  • Login