MIS215 Module 0 - Intro 1 MIS 215 Module 0 Intro to Data Structures.

Slides:



Advertisements
Similar presentations
C Programming Course Overview
Advertisements

Searching for Data Relationship between searching and sorting Simple linear searching Linear searching of sorted data Searching for string or numeric data.
Lecture 1: Comments, Variables, Assignment. Definitions The formal (human-readable) instructions that we give to the computer is called source code The.
CS 106 Introduction to Computer Science I 02 / 29 / 2008 Instructor: Michael Eckmann.
ISOM MIS 215 Module 7 – Sorting. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
Review. What to know You are responsible for all material covered in lecture, the readings, or the programming assignments There will also be some questions.
CS 280 Data Structures Professor John Peterson. Invariants Back to Invariants! Recall the insertion sort invariant – how can we turn this into debugging.
 Monday, 9/30/02, Slide #1 CS106 Introduction to CS1 Monday, 9/30/02  QUESTIONS (on HW02, etc.)??  Today: Libraries, program design  More on Functions!
Introduction and a Review of Basic Concepts
CS 106 Introduction to Computer Science I 02 / 28 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 07 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 04 / 29 / 2009 Instructor: Michael Eckmann.
CS503: Tenth Lecture, Fall 2008 Review Michael Barnathan.
Complexity (Running Time)
CS 206 Introduction to Computer Science II 12 / 10 / 2008 Instructor: Michael Eckmann.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
CS 106 Introduction to Computer Science I 10 / 15 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 10 / 16 / 2006 Instructor: Michael Eckmann.
Data Structures and Programming.  John Edgar2.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Week 2 - Friday.  What did we talk about last time?  Data representation  Binary numbers  Types  int  boolean  double  char  String.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Abstract Data Types (ADTs) Data Structures The Java Collections API
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
An Introduction to Textual Programming
ISOM MIS 215 Module 3 – Stacks and Queues. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 19 / 2007 Instructor: Michael Eckmann.
Instructor Information: Dr. Radwa El Shawi Room: Week # 1: Overview & Review.
Lecture 2: Classes and Objects, using Scanner and String.
CSE 131 Computer Science 1 Module 1: (basics of Java)
DATA STRUCTURES (CS212D) Week # 1: Overview & Review.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Arrays The concept of arrays Using arrays Arrays as arguments Processing an arrays data Multidimensional arrays Sorting data in an array Searching with.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
CIT 590 Intro to Programming First lecture on Java.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
CS 206 Introduction to Computer Science II 09 / 10 / 2009 Instructor: Michael Eckmann.
Introduction to programming in the Java programming language.
1 CS 177 Week 12 Recitation Slides Running Time and Performance.
JETT 2005 Session 5: Algorithms, Efficiency, Hashing and Hashtables.
ISOM MIS 215 Module 4 – Recursion. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
Data Structures and Algorithm Analysis Introduction Lecturer: Ligang Dong, egan Tel: , Office: SIEE Building.
CS101: Introduction to Computer Science Slides adapted from Sedgewick and Wayne Copyright © Your First Java.
1 Basic Java Constructs and Data Types – Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C.
Intermediate 2 Computing Unit 2 - Software Development.
ISOM MIS 215 Module 5 – Binary Trees. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
CS 106 Introduction to Computer Science I 03 / 02 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 01 / 22 / 2007 Instructor: Michael Eckmann.
Week 12 - Friday.  What did we talk about last time?  Finished hunters and prey  Class variables  Constants  Class constants  Started Big Oh notation.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Winter 2006CISC121 - Prof. McLeod1 Stuff No stuff today!
Dr. Sajib Datta CSE Spring 2016 INTERMEDIATE PROGRAMMING.
Data Structures and Algorithms in Java AlaaEddin 2012.
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
BIT 115: Introduction To Programming Professor: Dr. Baba Kofi Weusijana (say Doc-tor Way-oo-see-jah-nah, Doc-tor, or Bah-bah)
TCSS 342 Autumn 2004 Version TCSS 342 Data Structures & Algorithms Autumn 2004 Ed Hong.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
ISOM MIS 215 Module 1 – Ordered Lists. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
ISOM MIS 215 Module 5 – Binary Trees. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
The eclipse IDE IDE = “Integrated Development Environment”
MIS 215 Module 1 – Unordered Lists
CSE1320 INTERMEDIATE PROGRAMMING
CSE1320 INTERMEDIATE PROGRAMMING
CSE1320 INTERMEDIATE PROGRAMMING
COP 3502.
CSE1320 INTERMEDIATE PROGRAMMING
How to Run a Java Program
COP3530- Data Structures Introduction
Presentation transcript:

MIS215 Module 0 - Intro 1 MIS 215 Module 0 Intro to Data Structures

MIS215 Module 0 - Intro 2 Where are we? Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners MIS215 Binary Search Search Techniques Sorting Techniques Bubblesort Basic Algorithms Fast Sorting algos (quicksort, mergesort) Hashtables Graphs, Trees Linked Lists Stacks, Queues List StructuresAdvanced structures

MIS215 Module 0 - Intro 3 Today’s Buzzwords Data Structures Algorithms Efficiency of algorithms Analysis of algorithms Programming = Data Structures + Algorithms Programming as a problem-solving method Elluminate

Nuts and Bolts of this Class Elluminate  A tool for Synchronous Online Collaboration  This course will be all about collaboration  Start by clicking the link in the Course Calendar in WebCT  Allow Elluminate to install  Do not click on the microphone while in class! (believe me – bad things will happen if you do) Dr. Java and JDK 1.5 MIS215 Module 0 - Intro 4

Elluminate features we will use Definitely:  Private and moderator chats  Drawing board  Polling and quizzing Possibly:  Project presentations  Out-of-class meetings  Online office hours MIS215 Module 0 - Intro 5

6 Introduction to Data Structures What are data structures/ruptures & algorithms good for? Overview of data structures. Overview of algorithms Some definitions OO programming S/W engineering Java Library Data Structures

MIS215 Module 0 - Intro 7 What’s a program? So, far, if you’ve only done CS 208/209/equivalent, what has a program been? Probably, just doing some simple data manipulation..  store some grades in an array  average the grades, find min/max  anything else??

MIS215 Module 0 - Intro 8 Overview of Data Structures Arrays (unordered and ordered) Stacks, Queues, Lists  why did I lump these all together? Trees (binary, red-black [?], [?]) Hash table Heap

MIS215 Module 0 - Intro 9 Our approach to Problem Solving this quarter Dr. Java Integrated Development Environment Edit – Compile – Test – Debug Unfortunately CaTS won’t install in labs Fortunately it doesn’t take much to install Lets use Dr. Java to write our first program

MIS215 Module 0 - Intro 10 HelloWorld.java public class HelloWorld { public void run() { System.out.println("Hello Java World!"); } public static void main (String [] args) { HelloWorld tpo = new HelloWorld(); tpo.run(); }

MIS215 Module 0 - Intro 11 Dissecting HelloWorld Every program in Java is (at least) one class Each class has one or more methods. The class that runs the program is the main class, and has a main(…) method Typically, you should create an instance of a class in your main method, and call methods of that instance That’s exactly what HelloWorld Does!

MIS215 Module 0 - Intro 12 Lets do a little more… public class GradeCalculator { private int score = 843; // Score of the student public void run() { char letgrade = ''; //single quotes for characters // Do what is needed here to find the letter grade System.out.println("The student's letter grade is" + letgrade); } public static void main (String [] args) { GradeCalculator gc = new GradeCalculator(); gc.run(); }

MIS215 Module 0 - Intro 13 Dissecting GradeCalculator First finish it.. What is the logic for finding the letter grade from the numeric score? What is that “private int score;” business? What are our alternatives?

MIS215 Module 0 - Intro 14 The Input Class A stable class for easily receiving input from the users Documentation of this class is available at mples/complexity/Input.html mples/complexity/Input.html How do you use it?  Create an instance of the Input class  Call the appropriate method (with or without an argument) Why should you use the Input class?  Stable – includes some built-in error checks!

MIS215 Module 0 - Intro 15 Lets try it! Change GradeCalculator to ask the user for the numeric score Where should you create the Input class? What happens if you call the run() method multiple times? What is a better way?

MIS215 Module 0 - Intro 16 Going ahead – practising loops Write a program that asks the user to guess a number between 1 and 100. In a loop, let the computer make a guess, and the user says G/L/M (greater/less/match) Continue until you get a match Report the number of tries

MIS215 Module 0 - Intro 17 CFC – Comment-First Coding What is it? Why comments?  Descriptive  Think in English instead of the cryptic code  Will always compile!!!  Self-documenting Why comment-first? How do you fill out the comments? Lets try it!

MIS215 Module 0 - Intro 18 Only the run() method now.. public void run() { // Step 1. Initialization // Step 2. // Step 3. // Step 4. // Step 5. }

MIS215 Module 0 - Intro 19 Lets describe the steps public void run() { // Step 1. Initialization // set up the needed variables // Step 2. // Step 3. // Step 4. // Step 5. }

MIS215 Module 0 - Intro 20 Finally, fill in the code public void run() { // Step 1. Initialization // set up the needed variables int steps = 0, guess = 0; // any other variables? // Step 2. // Step 3. // Step 4. // Step 5. }

MIS215 Module 0 - Intro 21 Now what? Practice CFC – we will try to use this diligently this quarter. Every assignment you submit must have your names as comments at the top of the file, and all code must be extensively commented, preferably CFC-ed Did I just make up a verb there?

MIS215 Module 0 - Intro 22 Finally… Lets try to have fun as you write code Remember, programs do what we tell them to do – so we are the boss! There is nothing like “IT is not working” – IT always works – just like you tell it to – maybe you didn’t tell it to do the right thing! Practice, practice, practice… makes it perfect

Part 2 – Analysis of Algorithms There are many different ways to solve the same problem How do you tell if one way would be better than another? Analysis of algorithms is a method for identifying the efficiency of an algorithm MIS215 Module 0 - Intro 23

Order Notation (big-Oh/little-oh) For this course, we are only going to use the big Oh notation An algorithm is described to have the complexity of O(some function over n) For example, Mergesort has the complexity O(n lg n) No – that wasn’t a typo – lg(n) is log 2 (n) MIS215 Module 0 - Intro 24

So what does it mean? Lets first see how these functions behave: MIS215 Module 0 - Intro 25 nn2n2 lg(n)n lg(n)2n2n n! E E E+301#NUM! #NUM! #NUM! #NUM! #NUM!

So.. Can you compare now? Complexity of Bubblesort is O(n 2 ), and complexity of Mergesort is O(n lg n). Which one is more efficient? A. Bubblesort B. Mergesort C. Both are the same MIS215 Module 0 - Intro 26

How do you determine complexity of an algorithm? Typically involves mathematical induction For the purpose of this class, try to find the main loop of the algorithm, and determine the number of comparisons (or whichever is the most important operation is) Try to find an association between the input and the number of operations MIS215 Module 0 - Intro 27

The ComplexityDemo.java program Compile and run it – don’t worry too much about the source code at the moment See how the time behaves as you run the different algorithms If you feel adventurous, change the code a bit and try different input numbers (careful – some will not run for large inputs) MIS215 Module 0 - Intro 28