lecture_27_revised2

lecture_27_revised2 - 1 bfs.txt 2010-12-02 09:32 David...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1 · bfs.txt · 2010-12-02 09:32 · David Nicol Recursive definition of Depth-First-Search and Breadth-First-Search -- AddNodePtr enqueues a node * onto a First-Come-First-Serve queue, -- RemovePtr dequeues and returns a node * from that same queue void DFS(node *here) { if(here == NULL) return; DFS(here->left); printf( "at %p node %s\n" , here, here->attribute); DFS(here->right); } void BFS() { node *shownode = RemoveNodePtr(); if( shownode == NULL ) return; int children = 0; printf( "at %p node %s\n" , shownode, shownode->attribute); if( shownode->left ) AddNodePtr( shownode->left ); if( shownode->right) AddNodePtr( shownode->right ); BFS(); }
Background image of page 6
1 · hash.txt · 2010-11-30 16:38 · David Nicol Hash Table consider following example struct person { char name[100]; char dob[10]; int phone; }; struct person UofIstudent[32000]; If we want to find a students phone number (and the list) is unordered, we have to scan the entire list for(int i=0; i<32000; i++) { if(strcmp(Name,UofIstudents[i])==0) {
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/29/2011 for the course ECE 265 taught by Professor Kosbar during the Fall '09 term at Missouri S&T.

Page1 / 8

lecture_27_revised2 - 1 bfs.txt 2010-12-02 09:32 David...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online