Lecture10 - Algorithms in Systems Engineering IE170 Lecture...

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

View Full Document Right Arrow Icon
Algorithms in Systems Engineering IE170 Lecture 10 Dr. Ted Ralphs
Background image of page 1

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

View Full DocumentRight Arrow Icon
IE170 Lecture 10 1 References for Today’s Lecture Required reading CLRS Chapter 12 References D.E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching (Third Edition), 1998. R. Sedgewick, Algorithms in C++ (Third Edition), 1998.
Background image of page 2
IE170 Lecture 10 2 Selection Recall that the selection problem is that of finding the k th element in an ordered list. Selection can be done using an algorithm similar to the quicksort algorithm from Lab 2 (notice the connection again). However, we need an additional data member count in the node class that tracks the size of the subtree rooted at each node. With this additional data member, we can recursively search for the k th element. Starting at the root, if the size of the left subtree is k - 1 , return a pointer to the root. If the size of the left subtree is more than k - 1 , recursively search for the k th element of the left subtree. Otherwise, recursively search for the
Background image of page 3

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

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

This note was uploaded on 02/29/2008 for the course IE 170 taught by Professor Ralphs during the Spring '07 term at Lehigh University .

Page1 / 8

Lecture10 - Algorithms in Systems Engineering IE170 Lecture...

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

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