This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full 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
 Spring '08
 MinooAminian
 Sort, Binary numeral system, Positional notation, Decimal, RPI csci1190

Click to edit the document details