1 CS100J 29 March 2005 Arrays Reading: You are responsible for: Secs 8.1, 8.2, 8.3, 8.4 A decimal point I'm a dot in placeSlot machines Cash lost in 'em.

Slides:



Advertisements
Similar presentations
Chapter 19 Vectors, templates, and exceptions Bjarne Stroustrup
Advertisements

ArrayLists David Kauchak cs201 Spring Extendable array Arrays store data in sequential locations in memory Elements are accessed via their index.
© Trainer Bubble. Cryptic anagram puzzles (the clues are in the questions): dirty room here come dots lost.
1 CS100J 13 March 2006 Arrays. Reading: Secs 8.1, 8.2, 8.3. Listen to the following lectures on loops on your Plive CD. They are only 2-3 minutes long,
1 CS100J 27 March 2007 Algorithms on arrays Reading: 8.3–8.5 Please punctuate this: Dear John, I want a man who knows what love is all about you are generous.
Data Structures & Algorithms What The Course Is About s Data structures is concerned with the representation and manipulation of data. s All programs.
1 CS100J 14 March 2006 Arrays. Reading: Secs 8.1, 8.2, 8.3. Listen to the following lectures on loops on your Plive CD. They are only 2-3 minutes long,
1 CS100J 15 March, 2006 The while loop and assertions Read chapter 7 on loops. The lectures on the ProgramLive CD can be a big help. Some anagrams A decimal.
CS 1110 Prelim III: Review Session 1. Info My name: Bruno Abrahao – We have two other TA’s in the room to help you individually Beibei Zhu Suyong Zhao.
CS100J 17 March 2005 Arrays. Reading: Secs 8.1, 8.2, 8.3. The last Java feature to study in this course Quote for the Day: Computer science has its field.
1 Implementing a queue in an array Hashing We show a neat idea that allows a queue to be stored in an array but takes constant time for both adding and.
1 Algorithmic analysis Introduction. This handout tells you what you are responsible for concerning the analysis of algorithms You are responsible for:
1 CS100J 25 October 2006 Arrays. Reading: Secs 8.1, 8.2, 8.3. Listen to the following lectures on loops on your Plive CD. They are only 2-3 minutes long,
Module 6 Matrices & Applications Chapter 26 Matrices and Applications I.
CS2110 Recitation Week 8. Hashing Hashing: An implementation of a set. It provides O(1) expected time for set operations Set operations Make the set empty.
28/08/2015SJF L31 F21SF Software Engineering Foundations ASSUMPTIONS AND TESTING Monica Farrow EM G30 Material available on Vision.
Managing Business Data Lecture 8. Summary of Previous Lecture File Systems  Purpose and Limitations Database systems  Definition, advantages over file.
Computer Systems Chapter 1 Pages Hardware-physical pieces Key hardware components in a computer system: The physical parts. – Central processing.
Data Structures, Algorithms, & Applications
1 CS100J 16 March 2006 Arrays Reading: You are responsible for: Secs 8.1, 8.2, 8.3, 8.4 A decimal point I'm a dot in placeSlot machines Cash lost in 'em.
1 Linked Lists (continued (continued)) Lecture 5 (maybe) Copying and sorting singly linked lists Lists with head and last nodes Doubly linked lists Append/Circular.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Lecture 10: Class Review Dr John Levine Algorithms and Complexity March 13th 2006.
A review session 2013-T2 Lecture 16 School of Engineering and Computer Science, Victoria University of Wellington COMP 103 Marcus Frean.
MIS215 Module 0 - Intro 1 MIS 215 Module 0 Intro to Data Structures.
Object Oriented Programming Lecture 5: Arrays and Strings Mustafa Emre İlal
1 CS1110, 8 March 2009 Two topics: elementary graphics (for A5); loops Reading: Sec and chapter 7 on loops. The lectures on the ProgramLive CD can.
CPSC 102: Computer Science II Dr. Roy P. Pargas 408 Edwards Hall Office Hours 10:00-11:00 am MWF 2:00-3:00 pm TTh.
ASYMPTOTIC COMPLEXITY CS2111 CS2110 – Fall
Riddles & Puzzles. See if you can figure out these WUZZLES…shhhh don’t tell anyone if you figure it out.
1 - 1 CS230: Data Structures Spring 2007 Reading:Downey: Chapters 1, 2, 3, Sections , 4.13, , Chapters 5 and 6 Problem Set:Problem Set.
1 CS March 2010 Read: Sec and chapter 7 on loops. The lectures on the ProgramLive CD can be a big help. Some anagrams A decimal pointI'm.
1 CS100J 31 October 2006 Arrays: searching & sorting. Reading: 8.5 Merry Christmas!! On Halloween? Searching and sorting algorithms are on the course website.
CS 100Lecture 131 Announcements Exam stats P3 due on Thursday.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
1 CS100J 4 March 2008 Two topics: Turtles; loops Start reading Sec and chapter 7 on loops. The lectures on the ProgramLive CD can be a big help.
Data Structures Engr. Umbreen sabir What The Course Is About s Data structures is concerned with the representation and manipulation of data. s All programs.
CS November 2010 Developing array algorithms. Reading: Haikus (5-7-5) seen on Japanese computer monitors Yesterday it worked. Today it is.
Lecture 5 1.What is a variable 2.What types of information are stored in a variable 3.Getting user input from the keyboard 1.
Week 3 - Friday.  What did we talk about last time?  Operations on boolean values  !, &&, ||  Operations on char values  +, -  Operations on String.
CRE Programming Club - Class 2 Robert Eckstein and Robert Heard.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming –TextField Action Listeners, JEditorPane action listeners, HTML in a JEditorPane,
Cell Arrays Lecture 2/8/ Data Types (Review) 2. General Concept 3. Using Cell-Arrays 1. Syntax/Symbols 2. Dialog Boxes 1.
BIT116: Scripting Associative Arrays. Today AngularJS Q + A for the exam 2.
COP 3275 – Character Strings and Introduction to Pointers Instructor: Diego Rivera-Gutierrez.
1 CS100J 18 October 2005 Arrays Reading: You are responsible for: Secs 8.1, 8.2, 8.3, 8.4 A decimal point I'm a dot in placeSlot machines Cash lost in.
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 1 Scott Marino.
1 CS100J 06 March 2008 Read: Sec and chapter 7 on loops. The lectures on the ProgramLive CD can be a big help. Some anagrams A decimal pointI'm.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
CS100A, Fall Review of loops 1 CS100A, Fall 1998, Review of Loops and Loop Invariants Some students are still having trouble understanding loop invariants.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 9: Arrays; Revision Session.
CORRECTNESS ISSUES AND LOOP INVARIANTS Lecture 8 CS2110 – Fall 2014.
1 CS Oct 2008 Arrays. Reading: Secs 8.1, 8.2, 8.3 Listen to the following lectures on loops on your Plive CD. They are only 2-3 minutes long, and.
Topic: Binary Encoding – Part 2
CS100J 30 October 2007 Algorithms on arrays Reading: 8.3–8.5
This shows the user interface and the SQL Select for a situation with two criteria in an AND relationship.
CS October 2009 Read: Sec and chapter 7 on loops. The lectures on the ProgramLive CD can be a big help. Some anagrams A decimal point I'm.
Why Anagrams Are Cool! By Scott Trepanier 11/18/2018.
CS100A Lecture 15, 17 22, 29 October 1998 Sorting
Asymptotic complexity Searching/sorting
Java for Beginners University Greenwich Computing At School DASCO
Your Presentation Name
Sorting and Asymptotic Complexity
CS100A Lecture 15, 17 22, 29 October 1998 Sorting
Linear and Binary Search
CS100J 16 Oct, 2007 Assignment A5: loops
CS October 2010 Read: Sec and chapter 7 on loops. The lectures on the ProgramLive CD can be a big help. Some anagrams A decimal point I'm.
Presentation transcript:

1 CS100J 29 March 2005 Arrays Reading: You are responsible for: Secs 8.1, 8.2, 8.3, 8.4 A decimal point I'm a dot in placeSlot machines Cash lost in 'em Animosity Is no amityParishionersI hire parsons Debit card Bad creditSchoolmasterThe classroom Desperation A rope ends it Statue of libertyBuilt to stay free Dormitory Dirty roomThe Morse code Here come dots Eleven plus two Twelve plus oneVacation timesI’m not as active Evangelist Evil's agentFuneralReal fun The earthquakes That queen shakeIntoxicateExcitation Mother-in-law Woman hitlerWestern Union No wire unsent Ronald Wilson Reagan Insane Anglo Saxon warlord Snooze alarms Alas! No more Z's Victoria, England’s queen Governs a nice quiet land William Shakespeare I am a weakish speller William Shakespeare We all make his praise Some Anagrams (permutations of sequences of letters)

2 Today Quick overview of next two assignments. Look at horizontal notation for writing assertions about arrays. Write a method to tell whether two arrays are equal. Write a method to copy an array. Look at storing a table of values in a Java array. including adding a value to the table, deleting the last value of the table, deleting some other value from the table. The material on tables is in Sec. 8.4 of course text.

3 Next two assignments: A5 and A6 Create a rat race game. 1.The emphasis is on manipulating a rectangular array (we show you rectangular arrays on Thursday). 2.You will have to write code to read from a file (topic of this week’s lecture). 3.You will learn a little bit about GUIs (graphical user interfaces), but you won’t have to do any GUI programming. You will see how a program can “listen” for keystrokes.

4 Horizontal notation for arrays, strings, Vectors Example of an assertion about an array b. It asserts that: 1.b[0..k–1] is sorted (i.e. its values are in ascending order) 2.Everything in b[0..k-1] is ≤ everything in b[k..b.length–1] b = 0 k b.length b = 0 k b.length 1.b[0..k] is sorted (i.e. its values are in ascending order) 2.Everything in b[0..k] is ≤ everything in b[k+1..b.length–1] b = 0 k b.length

5 Maintain a table of values in an array int[] b= new int[5000]; // The n values in the table are in b[0..n–1] int n= 0; // 0 ≤ n <= 5000 b table of values this part is unused 0 n b.length As a program executes, it may have to maintain a table of values, say temperatures, within an array. The table will start out empty; then values will be added to it. We must say where in the array the values are stored. // Add t to the table: b[n]= t; n= n+1; // Delete last element of table // (assuming it exists). n= n –1;

6 Maintain a table of values in an array b table of values this part is unused 0 j n b.length // Delete value b[j] from the table. If the order of values in the table doesn’t matter: n= n–1; b[j]= b[n]; If the order of values in table does matter: n= n–1; // Move b[j+1..n] to b[j..n–1] // inv: b[j+1..k–1] have been moved for (int k= j+1; k–1 != n; k= k+1 ) { b[k–1]= b[k]; }