{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture6 - Beginning C for Engineers Spring 2008 Spring...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Beginning C for Engineers Spring 2008 Spring 2008 Lecture 6 Outline • Arrays – Sorting arrays – Searching arrays 2/21/2008 RPI- csci1190 2 • Number system Sorting Arrays • Sorting data : placing the data into particular order e.g. ascending or descending. 2/21/2008 RPI- csci1190 3 • Important computing application of arrays • Many sorting techniques, one of them: bubble sort Bubble Sort • The smaller values gradually “bubble” their way upward to the top of the array. • Larger values sink to the bottom of the array. 2/21/2008 RPI- csci1190 4 • Easy to program, yet for general purpose sorting one of the worst. Bubble Sort • This technique makes several passes through the array. • On each pass successive pairs of elements are compared. inputs 2/21/2008 RPI- csci1190 5 • If a pair is in decreasing order, their values are swapped in the array, otherwise we leave the values as they are. Searching • Sometimes you need to locate a record in a database using a key • Finding information in: 2/21/2008 RPI- csci1190 6 – Sorted array => Binary search – Unsorted array => Sequential search Sequential Search...
View Full Document

{[ snackBarMessage ]}

Page1 / 21

Lecture6 - Beginning C for Engineers Spring 2008 Spring...

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

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