Assignment 1 - Bag
Q1.a
Suppose that groceryBag is a bag filled to its
capacity with 10 strings that name various
groceries.
Write Java statements that remove and count
all occurrences of "soup" in gr
King Saud University
Department of Computer Science
CSC 212 Homework # 6
Fall 2017
This is an individual assignment.
Guidelines: The homework must be submitted electronically through
LMS.
Submissions
CSC 212 Homework # 2 Solution of Selected Prob
elms
ADT List & Double Linked List
Problem 1
1.
2. Write method insertAll as user of ADT List that takes two lists l1, l2 and
index i and insert all elem
CSC 212 Homework # 1 - Solution to Selected Problems
Performance Analysis
Problem 1
1. Show that 5n2 + 2n + 1 is O(n2 )
Answer 5n2 + 2n + 1 is O(n2 ) if 5n2 + 2n + 1 cn2 for c > 0 and n n0 , where n0
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial #2
Important: This tutorial has an online part, which you should
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial # 7
Important: This tutorial has an online part, which you shoul
CSC 212 Homework # 6
Heaps & Graphs
Due date: 08/01/2017 (5:00AM)
This is an individual assignment.
Guidelines: The homework must be submitted electronically through
LMS.
Hard copy submissions are not
1
JAVA REVISION
2
Objective
Object Oriented Programming (OOP): What,
Why, How
Analyzing and Designing OO Programs (Objects
& Classes)
Java Syntax, Java Program Skeleton
Analyzing and Designing a P
download instant at www.easysemester.com
Chapter 2: Bag Implementations That Use Arrays
1.
Why are the methods getIndexOf and removeEntry in the class ArrayBag private instead of public?
The methods a
DataStructuresIT212
Dr.SaharBayoumi
DepartmentofInformation
Technology
KingSaudUniversity
Description: This course emphasized the
importance of information hiding and how to use
abstraction in good pr
Chapter 1
Data Structures and Abstractions with Java, 3e
Frank Carrano
IT212 - 1435/1436 (3)
Bags
Outlines
The Bag
A Bags Behaviors
An Interface
Using the ADT Bag
Using an ADT Is Like Using a Ven
thatUseArrays
Chapter 2
Data Structures and Abstractions with Java, 3e
Frank Carrano
IT212 - 1435/1436 (3)
BagImplementations
Outlines
An Analogy
A Group of Core Methods
Implementing the Core Methods
KingSaudUniversity
CollegeofComputerandInformationSciences
DepartmentofInformationTechnology
IT212DataStructures
SummerSemester1435/1436
Assignment#1
1. Suppose that groceryBag is a bag filled to its
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial #8
Important: This tutorial has an online part, which you should
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial # 11
Important: This tutorial has an online part, which you shou
CSC 212 Homework # 3
Queues
Due date: 14/11/2017
This is an individual assignment.
Guidelines: The homework must be submitted electronically through
LMS.
Submissions by email and hard copy submissions
King Saud University
Department of Computer Science
CSC 212 Homework # 4
Stack & Recursion
This is an individual assignment.
Guidelines: The homework must be submitted electronically through
LMS.
Subm
CSC 212 Homework # 1
Performance Analysis
Due date: 14/10/2017
This is an individual assignment.
Guidelines: The homework must be submitted electronically through
LMS.
Hard copy submissions and submis
Example :
show Array queue after each step, size ,head
and tail
ArrayQueue <Integer> q=new ArrayQueue <Integer> (5);
q.enqueue(7);
q.enqueue(10);
q.enqueue(9);
int x=q.serve();
q.enqueue(8);
q.enqueue
RECURSION
CSC212: Data Structures
Recursion
Sometimes, certain statements in an algorithm are repeated
on different sizes of an input instance.
Repetition can be achieved in two different ways.
Ite
CSC212
Previous data structures (e.g. lists, stacks,
queues) have a linear structure.
Linear structures represent one-to-one
relation between data elements.
Trees have a nested or a hierarchical
struc
STACK OPERATIONS
CS212: Data Structure
Goodrich, Tamassia 2010
Applications of Stacks
Direct applications
Page-visited history in a Web browser
Undo sequence in a text editor
Chain of method calls
1
BINARY SEARCH TREES (BSTS)
CSC212: Data Structures
2
Binary Search Trees (BSTs)
A Binary Search Tree (BST) is a binary
tree such that for each node, say N, the
following statements are true:
1. If L
General Trees & Binary Trees
CSC212: Data Structures
2
Trees
Previous
data structures (e.g. lists, stacks,
queues) have a linear structure.
Linear structures represent one-to-one relation
between da
1.
What is the Big Oh for the code below
public int method1(int n) cfw_
if (n > 1) cfw_
return n;
else cfw_
return 0;
1.
What is the Big Oh for the code below
Public int method2(int n) cfw_
int sum
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial #9
Important: This tutorial has an online part, which you should
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial # 12
Important: This tutorial has an online part, which you shou
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial # 14
Problem 1
Show the adjacency matrix for graph a
Show the ad
King Saud University
College of Computer and Information Sciences
Computer Science Department
CSC 212
First Semester 1438-1439
Tutorial #10
Important: This tutorial has an online part, which you shoul