Download presentation
Presentation is loading. Please wait.
1
CEG 221 Introduction Mr. David Lippa
2
Overview Introduction –What’s this course about? A synthesis of language, theory, and application Language: –Programming Languages –Modular C programming Theory: Algorithm development & analysis Application: Algorithm implementation Syllabus Review-ish Questions
3
Programming Languages: High-Level vs. Low-Level High-Level Languages –Close to English, but slightly slower –Easy to use and easily read/interpreted code –Platform independent Low-Level Languages –Difficult to use but very fast –Typically is machine-specific
4
The Language: Why C? Strengths: –Powerful, Fast, Portable yet relatively high-level language –Provides organizational structure for creation, testing, and verification of code –Provides similar design paradigms to other engineering languages, such as FORTRAN Weaknesses: –Inferior to Object Oriented Programming (C++, Java) for releasable applications that require GUIs or greater complexity
5
Theory: Algorithms Algorithm – a series of steps that results in the performance of a task –Common algorithms used in CS: sorting, searching, populating data structures Algorithms are frequently analyzed based on the number of steps to complete the task based on the amount of elements to process. –Basically, answer the question: How much work does it take to process n elements in terms of n? (Big-Oh, Little-Oh notation – not covered in this course)
6
Algorithms: An Example Assume a room full of people, each person is a processor. In practice, sorting that room full of people by height is faster than by first name. Common sense tells us this, right? Everyone is an independent processor and can figure out where he/she belongs. Takes at most n memory accesses (look around the room at n people) to sort by height with n processors = n 2 steps of work. Sorting by name requires each person to ask every other person to figure out where he/she belongs. Takes n requests to each person (ask each person his/her last name) by n processors = n 2 steps of work. They’re the same!?
7
Algorithm Example (Continued) No – they’re not the same –Each person asking every other person takes longer than each person scanning their eyes around the room to find their place. –One can either ask or listen, so it requires each processor to wait for its turn to speak –Everyone can look at everyone else without any such conflicts THUS, sorting by height is the same Both take n 2 work under analysis, but when implemented, come out differently This is part of Algorithm Analysis
8
Algorithms: Analysis & Implementation There are various ways to implement “sorting people in a classroom.” –Divide and conquer – Selection Sort –Divide and merge – MergeSort –Move each to the proper spot – BubbleSort Each have best/worst cases. What you also need to look at is the average case. Pick the best depending on Best, Worst, Average Cases and the situation
9
Syllabus
10
Next Time: Review of Required Concepts Basic data types –Normal basic types, size_t, time_t Basic programming structure –Flow control / Repetition –Scope –Documentation of code –Modular programming Libraries Pass by reference (in C, by pointer) vs. pass by value Basic algorithm development –Design document –Pseudo code
11
QUESTIONS? My policy on questions: –You have the right to ask questions at ANY time in class. –The only stupid question is the one you don’t ask. Any questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.