Linked Lists
The linked list
Both arrays and array lists involve an inflexible
structure
The array list makes the resizing operation of its data array
transparent, but it still needs to happen every now and then
The array list still results in wasted memo
COMP 1900 Review Problem*
Suppose a hiking trail has elevation information
posted on markers at regular intervals on the trail.
This elevation information can be stored in an array,
where each element in the array represents the
elevation at a marker (in
COMP 2150 Fall 2012
Lab 8: Stacks
(Posted Nov. 13 Due Nov. 20 by 11:59 pm)
This lab will give you a concrete idea of why we made some of the decisions we did in the linked list and array
implementations of a stack.
1. (10 pts) Write a NaughtyLLStack<E> cl
Linked Lists
The linked list
Both arrays and array lists involve an inflexible
structure
The array list makes the resizing operation of its data
array transparent, but it still needs to happen every now and
then
The array list still results in wasted memo
COMP 2150 Fall 2016
Homework 8: Recursion
(35 points)
Number of People: Up to 2. If you work with someone else, include both your name and your teammates name on
all source code files. Only one person needs to submit the final product to eCourseware, but
COMP 2150 Fall 2016
Programming Assignment 2: Fantastic Fun with Netflix Filters
(75 points)
Number of People: Up to 2. If you work with someone else, include both your name and your teammates name on
all source code files. Only one person needs to submit
COMP 2150 Fall 2016
Homework 4: Polymorphism
(25 points)
Number of People: Individual. Feel free to ask me for help, or visit the Computer Science Learning Center
(http:/www.memphis.edu/cs/current_students/cslc.php).
Due: Mon., Oct. 3 by 5:30 pm
Submissio
Some Applications of Stacks
Evaluating arithmetic expressions
We usually write arithmetic expressions using infix
notation
The operator (+ - * /) is written in between the operands
Order of operations: PEMDAS
Can always use parentheses to force a specific
COMP 2150 Fall 2016
Homework 7: Stacks and Queues
(35 points)
Number of People: Individual. Feel free to ask me for help, or visit the Computer Science Learning Center
(http:/www.memphis.edu/cs/current_students/cslc.php).
Due: Wed., Nov. 9 by 5:30 pm
Subm
COMP 2150 Fall 2016
Project 1: Go Fish!
(75 points)
Number of People: Up to 2. If you work with someone else, include both your name and your teammates name on
all source code files. Only one person needs to submit the final product to eCourseware, but in
COMP 2150 Fall 2012
Lab 9: Queues
(Posted Nov. 25 Due Dec. 2 by 11:59 pm)
As we discussed in class, a queue is a data structure that supports these basic operations:
isEmpty returns whether the queue is empty
enqueue adds a new element to the back of the
Software Engineering Basics
Software engineering
l
l
Sit down and code approach works for small
projects, but not larger ones
Software engineering the field devoted to
the specification, design, production, and
maintenance of computer programs that are
de
COMP 2150 Fall 2012
Lab 5: Big-O
(Posted Oct. 15 Due Oct. 22 by 5:30 pm)
This lab is optional, but your score on it can be used to replace your lowest lab grade. (In other words, if
you do this lab, your lab grades will be best 8 of 10 instead of best 8 o
COMP 2150 Fall 2012
Lab 1: String Manipulation
(Posted Sept. 4 Due Sept. 11 by 5:30 pm)
Remember that as stated on the syllabus, this assignment should be an individual effort (contact me or visit the Computer
Science Learning Center, www.cs.memphis.edu/c
Inheritance, Part Deux
Parameters and inheritance
Because of the is-a relationship, an instance of a
subclass can be used in situations where the
superclass is specified.
Example: Suppose you have the following method
for the Animal class:
public void bat
COMP 2150 Fall 2012
Lab 6: Array Lists
(Posted Oct. 19 Due Oct. 30 by 11:59 pm)
Add the following methods to the ArrayListGeneric<E> class that we wrote during lecture (code posted on Oct. 23).
You may call the existing methods in ArrayListGeneric<E> if y
COMP 2150 Fall 2012
Lab 2: Classes and Objects
(Posted Sept. 12 Due Sept. 20 by 5:30 pm)
Remember that as stated on the syllabus, this assignment should be an individual effort (contact me or visit the
Computer Science Learning Center, www.cs.memphis.edu/
COMP 2150 Fall 2012
Programming Assignment 1: Othello
(Posted Sept. 16 - Due Oct. 16 by 11:59 pm)
Background Information
Othello (also known as Reversi) is a two-player game played on an 8x8 board similar to that used in chess or checkers.
Each player cho
COMP 2150 Fall 2012
Lab 3: Inheritance
(Posted Sept. 18 Due Sept. 26 by 5:30 pm)
Suppose youre designing a video game where the objective is to travel around the world collecting cute cartoonish
creatures that become stronger over time by fighting other c
COMP 2150 Fall 2012
Programming Assignment 2: Fantastic Fun with Netflix Filters
(Posted Oct. 21 - Due Nov. 14 by 11:59 pm)
Background Information
In case youve been living under a rock, Netflix (www.netflix.com)
is a service that provides unlimited strea
Some Applications of Stacks
Evaluating arithmetic expressions
We usually write arithmetic expressions using infix
notation
The operator (+ - * /) is written in between the operands
Order of operations: PEMDAS
Can always use parentheses to force a specific
COMP 2150 Fall 2012
Programming Assignment 3: Evaluating Infix Expressions
(Posted Nov. 10 Due Nov. 27 by 11:59 pm)
Background Information
As discussed in class, you can evaluate an infix expression by using two separate algorithms: one to convert the inf
COMP 2150 Fall 2016
Homework 1: String Manipulation
(25 points)
Number of People: Up to 2. If you work with someone else, include both your name and your teammates name on
all source code files. Only one person needs to submit the final product to eCourse
Introducing Data Structures
with the ArrayList
Our buddy, the array
As you know, an array is a collection of data of the
same type
An array is a simple example of a data structure a
structure that holds data, for lack of a better
definition
Arrays are gre
COMP 2150 Fall 2016
Homework 5: File Input and Big-O
(40 points)
Number of People: Individual. Feel free to ask me for help, or visit the Computer Science Learning Center
(http:/www.memphis.edu/cs/current_students/cslc.php).
Due: Wed., Oct. 12 by 5:30 pm
Trees
Trees are a data structure consisting of one or more data nodes. The first node is called the "root", and each node
has zero or more "child nodes". The maximum number of children of a single node, and the maximum depth of
children are limited in som
class ListNode cfw_
String data;
ListNode nextNode;
ListNode firstNode;
You could then write a method to add new nodes by inserting them at the beginning of the list:
ListNode newNode = new ListNode();
NewNode.nextNode = firstNode;
firstNode = newNode;
I
Queues
A queue is a data structure that is best described as "first in, first out". A real world example of a queue is people
waiting in line at the bank. As each person enters the bank, he or she is "enqueued" at the back of the line. When a
teller becom
COMP 2150 CS 2: Object-Oriented Programming and Data Structures Spring 2017
Mr. Kriangsiri (Top) Malasri
Contact Information:
Office: Dunn Hall 396
Department Office: Dunn Hall 375
Phone: 901.678.5689
Department Phone: 901.678.5465
Email: [email protected]