Assignment 1 - ITSC 2214 - Fall 2016
Objectives
At the completion of this assignment, students will be able to complete an array-based
implementation of a bag, define testing for a bag based on the in
INSERTION SORT
Ayman Hajja, PhD
INSERTION SORT
Insertion Sort: builds the final sorted array/list one item at a time.
Example:
The first element (3) is the sorted array (so far)
3
7
4
9
5
2
6
1
INSERT
HEAP SORT (COMPLETE)
Ayman Hajja, PhD
HEAP
Heap is a, clever, partially ordered data structure (or list)
Heap is a binary tree that exhibits the two following properties:
1. Shape property: must be co
QUICK SORT
Ayman Hajja, PhD
QUICK SORT
Similar to Merge Sort, Quick Sort is a sorting algorithms that uses the
divide-and-conquer algorithm design paradigm.
Recall that divide-and-conquer algorithms w
TOPOLOGICAL SORT
Ayman Hajja, PhD
TOPOLOGICAL SORT
Topological sort/ordering is an
ordering of a graph such that
before visiting any given node v,
all nodes pointed to that node v
have to be visited.
MERGE SORT
Ayman Hajja, PhD
MERGE SORT
Merge Sort is a sorting algorithms that uses the Divide-and-conquer
algorithm design paradigm.
Divide-and-conquer algorithms work as follows:
1. Problem is divid
SOLUTION TO FAKE COIN
PUZZLE
Ayman Hajja, PhD
FAKE COIN PROBLEM
Fake coin problem. Say you have x number of coins (or marbles), one of
which is fake. The fake coin is assumed to be lighter than the re
BINARY SEARCH & THE FAKE
COIN PUZZLE
Ayman Hajja, PhD
1
BINARY SEARCH PROBLEM
Given a list of *sorted* items, what is the best algorithm to find a
particular element?
Say I ask you to find element 12
Topic Outline Complexity Analysis & Searching
1. The Analysis Framework how we analyze the efficiency of algorithms.
a. There are two kinds of efficiency
i. Time Efficiency (Complexity) How fast an al
B-TREES PART 1
Ayman Hajja, PhD
B-TREES
Few notes about B-Trees:
1. B-Trees are self-balancing trees, they make sure that when you
add keys to it, it doesnt grow deep and stringy
2. B-Trees are not bi
HEAP SORT (COMPLETE)
Ayman Hajja, PhD
HEAP
Heap is a, clever, partially ordered data structure (or list)
Heap is a binary tree that exhibits the two following properties:
1. Shape property: must be co
SELECTION SORT & BUBBLE
SORT
Ayman Hajja, PhD
SORTING PROBLEM
Given a list of items, what is the best algorithm to sort the list in a
particular order (ascending or descending)? The best algorithm
is
ITCS 2215
Homework 2:Brute Force Algorithms
Fall 2017
Due Monday, Sept. 25, 2017, 2pm (In Class)
Notes:
This homework must be done individually by you.
Solve the problems in the space provided.
Rev
ITCS 2215
Homework 1:Big Oh/Induction
Fall 2017
Due Friday, Sept. 15, 2017, 2pm(In Class)
Notes:
This homework must be done individually by you.
Solve the problems in the space provided.
Review lec
ITCS 2215
Homework 2:Computational Complexity
Spring 2016
Due Thursday, Feb. 4, 2016, 9.30am(In Class)
For the following program fragments you will (a) write down the total work done by each
program s
Homework 4 Due 11:55PM 05/05/2016
Submit to moodle
Question (1) Use Binary Search to find 5 in a list: 1, 3, 5, 7, 9, 11, 13, 20, 70, 140,290
A list of numbers: 6, 2, 4, 5, 3, 1, 7 will be used in the
A-Star Notes
Open List- Available moves. Nodes weve discovered but not yet visited. Min Heap.
Closed List- Nodes weve visited and wont return to. Hash Table/dictionary.
For each node, maintain the fol
Midterm Study Guide
ITCS 2215 Design and Analysis of Algorithms
Your midterm is essentially divided into three (3) sections. Each section tests your knowledge of the material in a
different and increa
ITCS 2215 Design and Analysis of Algorithms
Homework #1
Lena Vawter
1. Answer the two questions below. Show you work where applicable:
a. Imagine that after washing 5 distinct pairs of socks, you disc
Design and Analysis of Algorithms ITCS 2215
Recursion Practice Problems
Instructions
For the following questions, determine the value returned as a result of the given method call.
1. public static in
ITCS-2215 (2015 Fall) Course Project Description
A group project will require students to apply the skills developed in the earlier sessions of the course to
the development of a proposal. Teams will
ITCS 2215
Homework 1:Big Oh/Induction
Fall 2017
Due Friday, Sept. 15, 2017, 2pm(In Class)
Notes:
This homework must be done individually by you.
Solve the problems in the space provided.
Review lec
BINARY (SEARCH) TREES,
TRAVERSAL ORDER
Ayman Hajja, PhD
BINARY TREES
Each node has at most two children
Example of binary trees is binary heaps
Many kinds of trees:
1. Perfect/Full binary tree
2. (Ess
ORDER OF GROWTH
Ayman Hajja, PhD
1
ORDER OF GROWTH
Difference in running times on small inputs is not what really
matters
How fast the function grows, for large inputs
To calculate/compare orders of g
B-TREES PART 2
Ayman Hajja, PhD
DELETING FROM A B-TREE
Deletion from a B-tree is more complicated than insertion, this is
because we can delete a key from any node and not just a
leaf.
DELETING FROM A
Week 3 Topic Outline - Analysis of Recursive Algorithms
Overview of Recursion
What is recursion and when is it used?
Repeat a process until you get it right
Recursion vs. Iteration whatever makes th