| CCS 2100 | | Comp 310 | | CCS 1300 | | CCS 1200 | | CCS 1100 | | CCS 1000 | | CS 212 | | Email: cpuccs@yahoo.com
Showing posts with label Data Structures and Algorithm. Show all posts
Showing posts with label Data Structures and Algorithm. Show all posts

Thursday, March 7, 2013

Graphs

The following is the link to the sample program demonstrating how Graphs works. (Note: click the smaller download link, not the big one in the ads):

Graphs
http://www.2shared.com/file/6--Tz48f/Graph.html

Wednesday, March 6, 2013

Mock Final Laboratory Exam Sample for Data Structures and Algorithm

The following is the link to the copy of mock test given in preparation for the final exams next week. (Note: click the smaller download link, not the big one in the ads):

Mock Programming Test

URL: http://www.2shared.com/file/3_e-C8Gg/Mock_Test.html

It contains the following:

      1. Abstract classes of the data structures' Array-Based Lists, Linked Lists, Stacks and Queues
      2. Sample programs of the said data structures as well as that of Recursion
      3. Sample test with instructions.

Note of the following laboratory exam schedules for the CCS 1300 S.Y. 2012-2013:
      1826 - March 15
      1827 - March 13
      1829 - March 19
      1830 - March 14

These will be during your laboratory schedule. Admittance only for those who arrive 15 minutes after the time.

Good luck!

Tuesday, February 26, 2013

Recursion Sample

The following is the link to the sample program demonstrating how Recursion works. (Note: click the smaller download link, not the big one in the ads):

Recursion
URL: http://www.2shared.com/file/MNHpIMfO/Recursion.html

Wednesday, February 20, 2013

Queues Example

The following is the link to the sample program demonstrating how queues work. (Note: click the smaller download link, not the big one in the ads):

Queues
http://www.2shared.com/file/XC5kxDuv/Queues.html

Tuesday, February 5, 2013

Heap Sort in Details

The following is the link to the document that shows the Heap Sort and how they work. (Note: click the smaller download link, not the big one in the ads):

Heap Sort
URL: http://www.2shared.com/file/CQtj69eE/hepsort.html

Wednesday, January 30, 2013

Stacks Example

The following is the link to a copy of a list using the stacks structure or better known as the Last In First Out.(Note: click the smaller download link, not the big one in the ads):

Stacks
URL: http://www.2shared.com/file/hlDfwyef/Stacks.html

Wednesday, January 23, 2013

Updated Order of Lecture Topics for CCS 1300


The following is the updated order of the lecture topics to be followed in CCS 1300: Data Structures and Algorithm. Please take note of the changes in preparation for the prefinal exams.

LECTURE TOPICS 

PRELIM
I.       Software Engineering Principles and Java Classes
1.     Software Life Cycle
2.     Software Development Phase
3.     Algorithm Analysis: The Big-O Notation
4.     User Defined Classes
5.     Abstract data types

II.     Inheritance and Exception Handling
1.     Inheritance
2.     Abstract Methods and Classes
3.     Composition
4.     Exception Handling

Quicksort atbp

Just wanted to share a very nice video on how Quicksort algorithm works.



The user also has more useful videos showing examples with other algorithm. Thanks Think Aloud Academy! Enjoy!

Monday, January 14, 2013

Linked Lists Example

The following is the link for the complete sample program of an integer list that use Link lists data structure. (Note: click the smaller download link, not the big one in the ads):

Linked Lists
http://www.2shared.com/file/wXvYA1aw/Linked.html

The file is in ZIP format. Simply extract it to access the codes.

Or you may encode the following 5 java classes:

---------------------------------TestProg_Linked.java-----------------------

import java.io.*;
import java.util.*;

public class TestProg_Linked
{
    static BufferedReader keyboard = new
           BufferedReader(new InputStreamReader(System.in));

Wednesday, January 9, 2013

Array-Based Lists Example

The following is the link for the complete sample program of an integer list that use array-based data structure. (Note: click the smaller download link, not the big one in the ads):

Array-Based List
URL: http://www.2shared.com/file/pA8UVyql/1_-_Array_Based.html

The file is in ZIP format. Simply extract it to access the codes.

Or you may encode the following 5 java classes:

------------------------TestProg_Array.java------------------------

//Test Program Integer Array List
import java.io.*;
import java.util.*;

public class TestProg_Array
{
    static BufferedReader keyboard = new
           BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) throws IOException
    {
        UnorderedArrayList intList = new UnorderedArrayList(50);
        IntElement num = new IntElement();

Wednesday, December 19, 2012

Review: Switch Case Java Samples


This is a simple example of how Switch Case statements in Java work:

-----------------------------SwitchCase.java-----------------------------

import java.io.*;
import java.util.*;

public class SwitchCase {
public static void main(String [] args) throws IOException{
BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
int x = 2;
switch(x){
case 1:
System.out.println("x is 1!");
break;
case 2:
System.out.println("x is 2!");
                  System.out.println("Hello!");
                  break;
case 3:
System.out.println("x is 3!");
break;
default:
          System.out.println("x is invalid!");
break;
} // switch closes
}
}


-----------------------------end of SwitchCase.java-----------------------------

Problem: Create a program that would ask the user for the following options:
1: to add
2: to multiply
3: to deduct
Then ask the user for two numbers and display the answer based on the operation chosen.

----------------------Calc.java----------------------------

import java.io.*;
import java.util.*;

public class Calc {
public static void main(String [] args) throws IOException{
BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
int option, first, second, answer;

System.out.print("1: to add \n2: to multiply \n3: to deduct \nEnter option: ");
option = Integer.parseInt(keyboard.readLine());
System.out.print("Enter first number: ");
first = Integer.parseInt(keyboard.readLine());
System.out.print("Enter second number: ");
second = Integer.parseInt(keyboard.readLine());

switch(option){
case 1: answer = first + second; break;
case 2: answer = first * second; break;
case 3: answer = first - second; break;
default: System.out.print("Invalid"); answer = 0; break;
}

System.out.println("Answer: " + answer);
}
}


----------------------end of Calc.java----------------------------


------------------------Options.java ----------------------------------



import java.io.*; import java.util.*;
public class Options {
public static void main(String [] args) throws IOException{
BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
int option;
System.out.print("Enter option: ");
option = Integer.parseInt(keyboard.readLine());

switch(option){
case 1:
for(int i = 1; i <= 10; i++) { System.out.print(i + " ");}
break;
case 2:
int sum, no1, no2;
System.out.print("Enter first number: ");
no1 = Integer.parseInt(keyboard.readLine());
System.out.print("Enter second number: ");
no2 = Integer.parseInt(keyboard.readLine());
sum = no1 + no2;
System.out.print("The sum is " + sum);
break;
case 3:
int no, rem;
System.out.print("Enter number: ");
no = Integer.parseInt(keyboard.readLine());
rem = no % 2;
if(rem == 1) System.out.print("Odd.");
else System.out.print("Even");
break;
default:
System.out.print("Invalid option");
break;
}

}

}


------------------------end of Options.java ----------------------------------

Monday, December 10, 2012

Research Assignment for CCS 1300

Research Assignment for CCS 1300

Define, identify the functions and methods(and their purpose), and give concrete examples (both in real life and in programming) of the basic types of data structures:

1.     Array – Based Lists
2.     Linked – Lists
3.     Recursion
4.     Stacks
5.     Queues

Pass with your full name, subject description, stub code and lecture schedule at the top of the document.

Format: Short Bond Paper
            Margins: 1” in 4 corners
            Font: Arial
            Size: 11

Deadline: for soft copies, email to cpuccs@yahoo.com with the subject “1300 Research” until January 3, 2013. If the subject is incorrect, your email will be ignored.

For hard copies, pass your work on or before January 8, 2013. Late papers will not be accepted and would automatically merit a score of ZERO. No need to place in a folder but keep the papers neat and stapled properly.

Note: Plagiarism would not merit any score. Although noting references is allowed, copy/paste method is NOT.

- Sir Rod.


Monday, December 3, 2012

Presentations for Chapter 1 and 2

The following are the download links for Chapter 1 and 2 of out CCS 1300 Data Structures and Algorithm classes.

Chapter 1:
http://www.2shared.com/document/wFrd5n4D/chap01.html

Chapter 2:
http://www.2shared.com/document/lihquBR0/chap02.html

P.S. Note that the download button would be the smaller one at the bottom, not the one in the ads.

Wednesday, November 21, 2012

CCS 1300 Course Outline

CCS 1300: Course Outline

Click HERE
or visit
http://www.2shared.com/document/C1ICLM_O/COURSE_OUTLINE_CCS1300.html

Data Structures and Algorithm: Object Oriented Design: Example 1: Circle

Data Structures and Algorithm: Object Oriented Design: Example 1: Circle

Problem: Create a program that would ask the user for the radius of a circle then display its area and circumference.
CLASS: Circle, TestProgCircle

// Circle.java -------------------------------------------------------------
public class Circle {
private double rad;
private double a;
private double c;

public Circle(){ //default constructor
rad = 0;
}

public Circle(double r){ //constructor with parameters
rad = r;
}

public Circle(Circle other){ //copy constructor
rad = other.rad;
}

public String toString(){
String str;
a = 3.1416 * rad * rad;
c = 3.1416 * 2 * rad;
str = "The area is " + a + " and the circumference is " + c;
return str;
}
}
// end of Circle.java -----------------------------------------------------

// TestProgCircle.java ----------------------------------------------------
import java.io.*;
import java.util.*;

public class TestProgCircle {
public static void main(String [] args) throws IOException{
BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
double no;

System.out.print("Enter a radius: ");
no = Double.parseDouble(keyboard.readLine());

Circle c1 = new Circle(no);

System.out.println("C1: " + c1);
}
}
// end of TestProgCircle.java ---------------------------------------------

Thursday, September 27, 2012

Data Structures and Algorithm Using Java Sample Program

Data Structures and Algorithm Using Java Sample Program

Click Here or

Here is the link:
http://www.2shared.com/file/zzLAufJu/Sample_Prog.html

Samples of Stacks and Queues are present with the filename Test_Lastname.java

Goodluck with the final exams!

Sunday, July 22, 2012

Address Book using Array-Based Lists

The following is a program that would act as an Address Book using Array-Based Lists:

http://www.2shared.com/file/u6X0pBTZ/AddressBook.html

NOTE: Copy Ch3_Ex8Data.txt in the Drive C:.

Abstract Functions in ArrayClassList

Here is the link for a program that shows how to tap the abstract functions of the ArrayListClass:

http://www.2shared.com/file/-0Si-vsF/Abstract_Func.html

Sunday, July 15, 2012

Array-Based Lists (Chapter 3)

Array-Based Lists
http://www.2shared.com/file/EBAxGx23/ArrayBasedList.html

This program would ask the user for 8 integers. Then, it will ask a position to be deleted and display the smallest number.

Friday, June 29, 2012

Course Outlines

The following are the download links for the give courses.

CCS 1000: Computer Fundamentals
http://www.2shared.com/file/CtTFZ7O8/CCS_1000.html

CCS 1100: Foundations of C Programming
http://www.2shared.com/file/LFXXoHDt/CCS_1100.html

CS 212: Data Structures and Algorithm Using Java
http://www.2shared.com/file/OGgUhISH/CS_212.html